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.
npx agentmods add rules/abderrahimghazali/cursor-rules/drupal-injectiongit clone --depth 1 https://github.com/abderrahimghazali/cursor-rulesWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.01612 |
| Opus 5 | $0.00000 | $0.00806 |
| Sonnet 5 | $0.00000 | $0.00322 |
| Haiku 4.5 | $0.00000 | $0.00161 |
Grade A, and why
drupal-injection 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.
This is a copy
89% identical to drupal-injection — 206 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.
How it starts
The opening of the file, as written. The whole thing — 135 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Drupal Injection Security Standards (OWASP A03:2021)
This rule enforces security best practices to prevent injection vulnerabilities in Drupal applications, as defined in OWASP Top 10:2021-A03.
actions:
-
type: enforce conditions:
Pattern 1: Raw SQL queries without placeholders
- pattern: "db_query\(['"][^'"]\$[^'"]['"]" message: "Direct variables in SQL queries are vulnerable to SQL injection. Use parameterized queries with placeholders."
Pattern 2: Modern DB API without placeholders
- pattern: "->query\(['"][^'"]\$[^'"]['"]" message: "Use parameterized queries with placeholders to prevent SQL injection: ->query($sql, [$param1, $param2])."
Pattern 3: Unescaped output
- pattern: "<?=|<?php\s+echo\s+(?!(t|\\t|\$this->t))[^;]*;" message: "Direct output may lead to XSS. Use t(), escaped variables with Html::escape(), or Twig templates."
Pattern 4: Unfiltered user input in render arrays
- pattern: "["']#markup["']\s*=>\s*(?!t\(|\\t\(|Xss::filterAdmin|Html::escape)\$" message: "Never use unfiltered variables in #markup. Use t(), Xss::filterAdmin(), or Html::escape()."
Pattern 5: Unescaped variables in JavaScript settings
- pattern: "->addJsSettings\(\[(?![^\]]*(Xss::filter|Json::encode))\$" message: "Filter variables before adding to JavaScript settings using Xss::filter() or properly encode with Json::encode()."
Pattern 6: Direct command execution
- pattern: "exec\(|shell_exec\(|system\(|passthru\(|proc_open\(|popen\(|`" message: "Command execution functions can lead to command injection. Use Symfony\Component\Process\Process if necessary."
Pattern 7: Unvalidated redirect
- pattern: "->redirect\(\s*\$(?!(this->|allowed_destinations|config))" message: "Unvalidated redirects can lead to open redirect vulnerabilities. Whitelist allowed destinations."
Pattern 8: Raw user input in conditions
- pattern: "->condition\([^,],\s\$(?!(this->|config|entity|storage))[^,]*," message: "Use proper input validation before using variables in database conditions to prevent SQL injection."
Pattern 9: Missing CSRF protection in forms
- pattern: "(?<!buildForm|getFormId)\sfunction\s+[a-zA-Z0-9_]+Form\s\([^{]*\{[^}]return\s+\$form;(?![^}]FormBuilderInterface|[^}]::TOKEN|[^}]#token)" message: "Form submissions must include CSRF protection with $form['#token']."
Pattern 10: Unvalidated file operations
- pattern: "file_get_contents\(\s*\$(?!(this->|allowed_paths|config))" message: "Validate file paths before operations to prevent path traversal attacks."
-
type: suggest message: | Drupal Injection Prevention Best Practices:
-
SQL Injection Prevention:
- Always use parameterized queries with placeholders
- Use the Database API's condition methods: ->condition(), ->where()
- Properly escape table and field names with {}
- Consider using EntityQuery for entity operations
-
XSS Prevention:
- Use Drupal's t() function for user-visible strings
- Apply appropriate filtering: Html::escape(), Xss::filter(), Xss::filterAdmin()
- Use #plain_text instead of #markup when displaying user input
- Utilize Twig's automatic escaping in templates
- For admin UIs, be careful with Xss::filterAdmin() as it allows some tags
-
CSRF Protection:
- Always include form tokens with $form['#token']
- Validate form tokens with FormState->validateToken()
- For AJAX requests, utilize Drupal's ajax framework
- Use drupal_valid_token() for custom validation
-
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.
- 2d ago First seen · 135 lines · 1,612 tokens per session scan A 4dbf68efc505
drupal-injection 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,612 tokens. A static security scan graded it A with 0 findings. It is 89% identical to drupal-injection, differing in 206 lines, and is treated as a copy.
Other cursor rules, from other repositories
creating-cursor-rules
Meta-rule for creating effective Cursor IDE rules with best practices, patterns, and examples.
creating-skills
Meta-guide for creating effective Claude Code skills with proper structure, CSO optimization, and real examples.
cursorrules
You are a disciplined senior engineer working with someone who may be a domain expert, not a programmer. Build it correctly and safely, not just fast.
cursorrules
Cursor rule "cursorrules" from BlueBirdBack/godot-cursorrules, covering godot 4.4 game development .cursorrules, core development guidelines, code style, naming conventions and scene organization.
new_feature
You are an expert Product Owner and Technical Lead focused on helping users define and plan new features through collaborative discovery and structured documentation.
new_project
You are an expert Product Owner focused on helping users define new software projects through collaborative vision creation.