Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Usage Milestone: Google Analytics Module google_analytics crossed 1,000 active installs. Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: GraphQL Compose Codegen 1.1.2 Minor update available for module graphql_compose_codegen (1.1.2). Release: Mapy.com 1.1.3 Minor update available for module mapycom (1.1.3). Release: Ckeditor5 entity browser 3.0.3 Minor update available for module ckeditor5_entity_browser (3.0.3). Release: Ckeditor5 entity browser 3.0.1 Minor update available for module ckeditor5_entity_browser (3.0.1). Release: Ckeditor5 entity browser 3.0.2 Minor update available for module ckeditor5_entity_browser (3.0.2). Release: Teamleader Integration 4.0.2 Minor update available for module teamleader (4.0.2). Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Search Security Enhanced

13 sites No security coverage Drupal 10–11
View on drupal.org

This module protects your Drupal site from malicious search injection attacks by detecting and filtering suspicious search queries in real-time. It cleans search parameters, blocks scam phrases and phone numbers, and can redirect users to a warning page or block them entirely. The module offers configurable protection levels, detailed logging, and email alerts for administrators.

Introduction

Search Security Enhanced protects your Drupal site from malicious search injection attacks, especially those used in phone scam operations. Attackers often try to inject fake phone numbers or scam phrases through search parameters to exploit your content.

This module detects and filters suspicious search queries before they reach users or get indexed by search engines. It provides:

  • Real-time detection of malicious query patterns
  • Smart parameter cleaning and user redirection
  • Configurable protection levels: Basic, Moderate, Strict
  • Phone number and scam keyword blocking
  • Educational warnings for users
  • Detailed logging and email alerts for administrators

Whether you're running a government website, a membership portal, or a service directory, this module helps protect your search experience from exploitation and abuse.

Features

  • Search Parameter Protection: Detects scam phrases, phone numbers, suspicious encodings
  • Smart Redirects: Cleans query parameters and keeps users on the page
  • Custom Warning Pages: Show contextual security alerts and contact options
  • Flexible Response Behavior: Choose between clean redirect, warning page, or hard block
  • Granular Detection Settings: Control query length limits, allowed parameters, and blocklists
  • Comprehensive Logging: All detected threats are logged
  • Email Notifications: Admins receive alerts on detection events
  • Developer-Ready: Hooks, services, Twig templates, and full configuration API
  • Mobile-Responsive: Works across devices without affecting UX
  • Seamless Integration: Supports search404 and views_pretty_path modules
  • Safe Custom Search Paths: Monitor non-default search URLs

What It Blocks

Search Security blocks common patterns used in scam operations, such as:

  • “call now 555-1234”
  • “urgent verify account immediately”
  • “technical support suspended account”
  • Phone number variations like (555) 123-4567 or +1-555-123-4567
  • URL-encoded threats like %20call%20now
  • Mixed terms like drupal development call now 555-1234
  • Overly long search queries meant to overwhelm the system

Legitimate URLs like /search?keys=web+development&utm_source=google are left untouched.

After Installation

Once installed, visit /admin/config/security/search-security to:

  • Choose your desired protection level
  • Enable phone number and keyword detection
  • Configure how malicious queries are handled
  • Set up warning messages and contact links
  • Review the blocklist and allowlist
  • Monitor logs and test detection

Performance & UX

Clean redirect ensures users stay on the page, unaware of any threat
Admins can display a clear warning or educational page if preferred
Designed to minimize false positives and allow fine-tuning
EventSubscriber automatically skips admin routes and APIs
Negligible impact on performance, even on high-traffic sites

For Developers

Search Security provides:

  • A dedicated detection service: search_security.detector
  • Hooks for theme integration and page preprocessing
  • Configurable warning templates (search-security-warning.html.twig)
  • Support for extending detection patterns and whitelists
  • Configuration export support for CI/CD pipelines
  • Clean, PSR-4 structured code with PHP 8.3 compatibility

Example:

$is_malicious = \Drupal::service('search_security.detector')->containsMaliciousPattern($query);

Recommended Modules

  • search404: Adds support for custom 404 search paths
  • views_pretty_path: Enables protection for pretty filter URLs in Views

Similar Projects

Most spam and injection filters in Drupal focus on forms or comment fields.
Search Security Enhanced is purpose-built to protect search pages, clean URL parameters, and educate users.

It’s the only module offering:

  • Real-time query sanitization
  • Phone number pattern detection
  • Redirects with cleaned parameters
  • Configurable warning pages
  • Full integration with Drupal's routing and logging systems

Community & Documentation

Full documentation is available in the README.

Depends on

Dependencies of the latest stable release

  • system Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Jul 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Core Release date
1.0.0 Stable 10–11 Jul 2, 2025