drupal-ssrf

A Drupal code rule that checks for Server-Side Request Forgery, or SSRF, where a server is tricked into making HTTP requests chosen by a user.

In plain words
What is it for?
Use it when reviewing Drupal PHP code and Guzzle or HTTP-client calls that use request parameters, cookies, headers, or other user-controlled values in URLs.
Why use it?
It helps find requests built from untrusted input, which can expose internal services or retrieve data that the user should not access.

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/ivangrynenko/cursorrules/drupal-ssrf
Clone the repo
git clone --depth 1 https://github.com/ivangrynenko/cursorrules

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,647 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found 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.01647
Opus 5 $0.00000 $0.00823
Sonnet 5 $0.00000 $0.00329
Haiku 4.5 $0.00000 $0.00165

Measured yesterday against content hash 6ce98d61d96c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

drupal-ssrf 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 yesterday.

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.

.cursor/rules/drupal-ssrf.mdc · 102 lines

How it starts

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

Drupal Server-Side Request Forgery Standards (OWASP A10:2021)

This rule enforces security best practices to prevent Server-Side Request Forgery (SSRF) vulnerabilities in Drupal applications, as defined in OWASP Top 10:2021-A10.

Rule Details

  • Name: drupal_ssrf

  • Description: Detect and prevent Server-Side Request Forgery (SSRF) vulnerabilities in Drupal applications as defined in OWASP Top 10:2021-A10

Filters

  • file extension pattern: \\.(php|inc|module|install|theme)$
  • file path pattern: .*

Enforcement Checks

  • Conditions:
    • pattern (file_get_contents|fopen|curl_exec|drupal_http_request|\\$client->request|\\$client->get|Drupal::httpClient\\(\\)->get)\\s*\\([^)]*\\$_(GET|POST|REQUEST|COOKIE|SERVER|FILES)[^)]*\\) – Potential SSRF vulnerability: URL constructed with user input. Validate and sanitize user-supplied URL parameters before making requests.
      • Pattern 1: Unsafe URL construction with user input
    • pattern GuzzleHttp\\\\Client[^;]*;[^;]*->request\\s*\\([^;]*\\$[^;]* – Validate and restrict URLs before making HTTP requests with Guzzle to prevent SSRF attacks.
      • Pattern 2: Unsafe Guzzle HTTP client usage
    • pattern (Http(Client|Request)|curl_exec|file_get_contents)\\s*\\([^)]*(http|\\$[a-zA-Z0-9_]+)[^)]*\\)[^;]*;(?![^;]*(valid|check|sanitize|UrlHelper)) – HTTP requests should validate URLs with \Drupal\Component\Utility\UrlHelper::isValid() before execution to prevent SSRF.
      • Pattern 3: Missing URL validation before making HTTP requests
    • pattern (https?:?//|www\\.)\\s*\\.\\s*\\$[a-zA-Z0-9_]+ – Potential SSRF vulnerability: URL being constructed with variable concatenation. Use URL validation and allowlisting.
      • Pattern 4: Unsafe URL construction with variable input
    • pattern file_get_contents\\([\"'](mdc:?:http|https|ftp|php|data|expect|zip|phar):// – Avoid using PHP wrappers with file operations that could lead to SSRF vulnerabilities.
      • Pattern 5: Using file system wrappers which can lead to SSRF
    • pattern CURLOPT_PROXY[^;]*none|CURLOPT_PROXY[^;]*null – Bypassing proxy settings can lead to SSRF vulnerabilities. Maintain proper proxy configurations.
      • Pattern 6: Bypassing local proxy settings
    • pattern simplexml_load_|DOMDocument|SimpleXMLElement|xml_parse – XML processing without disabling external entities can lead to XXE and SSRF. Use libxml_disable_entity_loader(true).
      • Pattern 7: Unsafe processing of XML with external entities
    • pattern (127\\.0\\.0\\.1|10\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}|172\\.(1[6-9]|2[0-9]|3[0-1])\\.[0-9]{1,3}\\.[0-9]{1,3}|192\\.168\\.[0-9]{1,3}\\.[0-9]{1,3}|169\\.254\\.[0-9]{1,3}\\.[0-9]{1,3}|localhost) – Hardcoded internal IP addresses or localhost may facilitate SSRF attacks if exposed to user manipulation.
      • Pattern 8: Accessing or using internal network IPs
    • pattern \\\\Drupal::httpClient\\(\\)(?!.*[^;]*UrlHelper::isValid) – Always validate URLs with UrlHelper::isValid() before making HTTP requests with Drupal's HTTP client.
      • Pattern 9: Custom Drupal HTTP client usage without validation
    • pattern curl_setopt\\([^,]+,\\s*CURLOPT_PORT,\\s*\\$[a-zA-Z0-9_]+ – Potential SSRF vulnerability: Restrict allowed ports for outbound HTTP requests to prevent service probing.
      • Pattern 10: Allowing unrestricted ports in HTTP requests

Read the full file on GitHub · 102 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. yesterday First seen · 102 lines · 1,647 tokens per session scan A 6ce98d61d96c

Subscribe to this mod's changes

drupal-ssrf is a cursor rule published in the GitHub repository ivangrynenko/cursorrules (87 stars, last pushed 10mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,647 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.