drupal-integrity-failures

Security rules for Drupal that check how code and data are loaded, decoded, and updated. Drupal is a system for building and managing websites, while insecure deserialization means turning untrusted data back into objects or values unsafely.

In plain words
What is it for?
Use them when reviewing Drupal code for unserialize calls, eval-like functions, variable file paths, and update hooks or settings related to update verification.
Why use it?
They help catch dangerous PHP code execution, unsafe file inclusion, insecure data decoding, and update processes that do not verify integrity.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/abderrahimghazali/cursor-rules/drupal-integrity-failures
Clone the repo
git clone --depth 1 https://github.com/abderrahimghazali/cursor-rules

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,506 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 91% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01506
Opus 5 $0.00000 $0.00753
Sonnet 5 $0.00000 $0.00301
Haiku 4.5 $0.00000 $0.00151

Measured 2d ago against content hash eb8fc578e69c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

drupal-integrity-failures scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

91% identical to drupal-integrity-failures — 216 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/drupal-integrity-failures.mdc · 139 lines

How it starts

The opening of the file, as written. The whole thing — 139 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Drupal Software and Data Integrity Failures Standards (OWASP A08:2021)

This rule enforces security best practices to prevent software and data integrity failures in Drupal applications, as defined in OWASP Top 10:2021-A08.

actions:

  • type: enforce conditions:

    Pattern 1: Insecure deserialization

    • pattern: "unserialize\(\$|unserialize\([^,]+\$|php_unserialize\(\$" message: "Insecure PHP deserialization detected. Use safer alternatives like JSON for data interchange or implement proper validation before deserialization."

    Pattern 2: Unsafe use of eval or similar functions

    • pattern: "eval\(|assert\(|create_function\(" message: "Potentially dangerous code execution function detected. Avoid dynamic code execution whenever possible."

    Pattern 3: Insecure plugin/module loading

    • pattern: "module_load_include\(\$|require(_once)?\s*\(\s*\$|include(_once)?\s*\(\s*\$" message: "Dynamic inclusion of files based on user input is dangerous. Use validated, allowlisted paths only."

    Pattern 4: Missing update verification

    • pattern: "update\.settings\.yml|function [a-zA-Z0-9_]+update[0-9]+\(\)" message: "Ensure update hooks validate the integrity of updates and data transformations to prevent unauthorized modifications."

    Pattern 5: Unsafe configuration imports

    • pattern: "ConfigImporter|\$config_importer|config_import|cmci" message: "Validate configuration before import to ensure integrity and detect potentially malicious changes."

    Pattern 6: Unchecked remote data

    • pattern: "drupal_http_request\(|\\Drupal::httpClient\(\)->get\(|curl_exec\(" message: "Always validate data from remote sources before processing or storing it. Implement integrity checks for remote content."

    Pattern 7: Insecure Composer usage

    • pattern: "composer\.json" message: "Verify you're using secure Composer practices: validate package signatures, pin dependencies, and use composer.lock."

    Pattern 8: Direct database modifications

    • pattern: "INSERT\s+INTO|UPDATE\s+[a-zA-Z0-9_]+\s+SET|db_update\(|->update\(|->insert\(" message: "Direct database modifications should implement validation to preserve data integrity. Prefer using entity API."

    Pattern 9: Missing file integrity verification

    • pattern: "file_save_data\(|file_save_upload\(|file_copy\(|file_move\(" message: "Implement file integrity checking for uploaded or manipulated files to prevent malicious content."

    Pattern 10: Unsafe entity creation

    • pattern: "\$entity\s*=\s*new\s+[A-Za-z]+\(|::create\(\$" message: "Validate all input used to create entity objects to maintain data integrity and prevent creating malicious entities."
  • type: suggest message: | Drupal Data & Software Integrity Best Practices:

    1. Secure Deserialization:

      • Avoid PHP's unserialize() with untrusted data entirely
      • Use JSON or other structured formats for data interchange
      • When deserialization is necessary, implement allowlists and validation
      • Consider using Drupal's typed data API for structured data handling
      • Avoid serializing sensitive data that could be tampered with
    2. Update & Configuration Integrity:

      • Validate data before and after migrations/updates
      • Implement checksums/hashing for critical configuration
      • Use Drupal's Configuration Management system properly
      • Monitor configuration changes for unauthorized modifications
      • Implement proper workflow for configuration management

Read the full file on GitHub · 139 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 139 lines · 1,506 tokens per session scan A eb8fc578e69c

Subscribe to this mod's changes

drupal-integrity-failures is a cursor rule published in the GitHub repository abderrahimghazali/cursor-rules (2 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,506 tokens. A static security scan graded it A with 0 findings. It is 91% identical to drupal-integrity-failures, differing in 216 lines, and is treated as a copy.