javascript-server-side-request-forgery

A set of JavaScript security rules for detecting server-side request forgery, where an attacker tricks a server into making requests to unintended locations.

In plain words
What is it for?
Use it when reviewing fetch, Axios, Node.js HTTP requests, redirects, and other code that builds URLs from user-provided values.
Why use it?
It highlights network requests and redirects that use untrusted input, which can expose internal services or data.

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/javascript-server-side-request-forgery
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 7,288 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.07288
Opus 5 $0.00000 $0.03644
Sonnet 5 $0.00000 $0.01458
Haiku 4.5 $0.00000 $0.00729

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

Security

Grade A, and why

javascript-server-side-request-forgery scanned grade A with 1 finding 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- pattern: "function\\s+[a-zA-Z0-9_]*(?:request|fetch|get|http|curl)\\s*\\([^)]*\\)\\s*\\{[^}]*(?:fetch|axios|http\\.get|http\\.request|https\\.get|https\\.request)"
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/javascript-server-side-request-forgery.mdc · 851 lines

How it starts

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

JavaScript Server-Side Request Forgery (OWASP A10:2021)

actions:

  • type: enforce conditions:

    Pattern 1: URL from User Input

    • pattern: "(fetch|axios\.get|axios\.post|axios\.put|axios\.delete|axios\.patch|http\.get|http\.request|https\.get|https\.request|\$\.ajax|XMLHttpRequest|got|request|superagent|needle)\s*\([^)]*(?:\$_GET|\$_POST|\$_REQUEST|req\.(?:body|query|params)|request\.(?:body|query|params)|event\.(?:body|queryStringParameters|pathParameters)|params|userInput|data\[" message: "Potential SSRF vulnerability: URL constructed from user input. Implement URL validation, allowlisting, or use a URL parser library to validate and sanitize user-provided URLs."

    Pattern 2: Dynamic URL in HTTP Request

    • pattern: "(fetch|axios|http\.get|http\.request|https\.get|https\.request|\$\.ajax|XMLHttpRequest|got|request|superagent|needle)\s*\(\s*['"]https?:\\/\\/[^'\"]['"`]\s\+\s*" message: "Potential SSRF vulnerability: Dynamic URL in HTTP request. Use URL parsing and validation before making the request."

    Pattern 3: URL Redirection Without Validation

    • pattern: "(res\.redirect|res\.location|window\.location|location\.href|location\.replace|location\.assign|location\.port|history\.pushState|history\.replaceState)\s*\([^)]*(?:req\.(?:query|body|params)|request\.(?:query|body|params)|userInput)" message: "URL redirection without proper validation may lead to SSRF. Implement strict validation for URLs before redirecting."

    Pattern 4: Direct IP Address Usage

    • pattern: "(fetch|axios\.get|axios\.post|axios\.put|axios\.delete|axios\.patch|http\.get|http\.request|https\.get|https\.request)\s*\(\s*['"`]https?:\/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" message: "Direct use of IP addresses in requests may bypass hostname-based restrictions. Consider using allowlisted hostnames instead."

    Pattern 5: Local Network Access

    • pattern: "(fetch|axios\.get|axios\.post|axios\.put|axios\.delete|axios\.patch|http\.get|http\.request|https\.get|https\.request)\s*\(\s*['"`]https?:\/\/(?:localhost|127\.0\.0\.1|0\.0\.0\.0|192\.168\.|10\.|172\.(?:1[6-9]|2[0-9]|3[0-1])\.|::1)" message: "Request to internal network address detected. Restrict access to internal resources to prevent SSRF attacks."

    Pattern 6: File Protocol Usage

    • pattern: "(fetch|axios\.get|axios\.post|axios\.put|axios\.delete|axios\.patch|http\.get|http\.request|https\.get|https\.request)\s*\(\s*['"`]file:\/\/" message: "Use of file:// protocol may lead to local file access. Block or restrict file:// protocol usage."

    Pattern 7: Missing URL Validation

    • pattern: "(fetch|axios\.get|axios\.post|axios\.put|axios\.delete|axios\.patch|http\.get|http\.request|https\.get|https\.request)\s*\([^)]\burl\b[^)]\)" negative_pattern: "(validat|sanitiz|check|parse).*\burl\b|allowlist|whitelist|URL\.(parse|canParse)|new URL\(|isValidURL" message: "HTTP request without URL validation. Implement URL validation before making external requests."

    Pattern 8: HTTP Request in User-Defined Function

    • pattern: "function\s+[a-zA-Z0-9_](?:request|fetch|get|http|curl)\s\([^)]\)\s\{[^}](?:fetch|axios|http\.get|http\.request|https\.get|https\.request)" negative_pattern: "(validat|sanitiz|check|parse).\burl\b|allowlist|whitelist|new URL\(|isValidURL" message: "User-defined HTTP request function without URL validation. Implement proper URL validation and sanitization."

    Pattern 9: Proxy Functionality

    • pattern: "(?:proxy|forward|relay).(?:req\.(?:url|path)|request\.(?:url|path))" negative_pattern: "(validat|sanitiz|check|parse).\burl\b|allowlist|whitelist" message: "Proxy or request forwarding functionality detected. Implement strict URL validation and allowlisting."

Read the full file on GitHub · 851 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 · 851 lines · 7,288 tokens per session scan A b64662fb2333

Subscribe to this mod's changes

javascript-server-side-request-forgery 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 7,288 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.