Drupal is a registered trademark of Dries Buytaert
Module Revived: Entity API 8.x-1.7 Module entity updated after 17 months of inactivity (8.x-1.7). Release: WebProfiler 11.2.2 Minor update available for module webprofiler (11.2.2). Release: Image Styles Builder 1.1.8 Minor update available for module image_styles_builder (1.1.8). Release: Static Suite 1.2.13 Minor update available for module static_suite (1.2.13). Release: Simple password policy 1.1.2 Minor update available for module simple_password_policy (1.1.2). Release: Simple password policy 1.1.1 Minor update available for module simple_password_policy (1.1.1). Release: Static Suite 1.2.12 Minor update available for module static_suite (1.2.12). Release: Audit Chain 1.4.0 Minor update available for module audit_chain (1.4.0). Release: Force External Authentication 1.0.0 Initial release available for module externalauth_force (1.0.0)! Usage Milestone: Field as Block Module fieldblock crossed 1,000 active installs.

This Drupal recipe installs AI guardrails that use regular expressions to detect and block personally identifiable information (PII) in AI interactions. It can be applied to any site where AI features process user input or generate output that might contain sensitive personal data, helping to protect user privacy and comply with data protection regulations.

A Drupal recipe that installs a set of regex-based AI guardrails to detect and block personally identifiable information (PII) in AI interactions. Apply this recipe to any site where AI features process user input or generate output that may contain sensitive personal data.

What This Recipe Does

This recipe installs four individual guardrails and one guardrail set into a Drupal site running the AI module.

Each guardrail uses a regular expression to scan text for a specific type of PII. The pii_protection guardrail set applies all four guardrails to both the pre-generate (user input) and post-generate (AI output) phases, so PII is blocked in both directions.

When to use this recipe

  • Any public-facing AI interaction (chatbots, AI assistants, AI-powered search)
  • Sites with GDPR or data protection obligations
  • Environments where user content must not be forwarded to third-party AI providers containing sensitive identifiers

Requirements

How to Apply

Run the following Drush command from your Drupal root:

drush recipe ../recipes/ai_recipe_guardrails_pii

Configuration Installed

Guardrail Set

Machine name Label Description pii_protection PII Protection Applies all four PII guardrails to both pre- and post-generate phases. Stop threshold: 0.8.

Guardrails

Machine name Label Detects pii_email_address PII: Email Address Email addresses pii_credit_card_number PII: Credit Card Number Payment card numbers (Visa, Mastercard, Amex, Discover, etc.) pii_iban PII: IBAN IBAN bank account numbers pii_phone_number PII: Phone Number International phone numbers (E.164 / +XX format)

All guardrails use the regexp_guardrail plugin.

Activity

Tracked releases
1
Tracked since
Mar 2026
Latest release
4 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.0.0 Stable Mar 23, 2026