ssrf-prevention

Security rules for code that makes outbound network requests, including generated code. They prevent requests from being redirected to unsafe destinations such as internal computer networks.

In plain words
What is it for?
Use them when building HTTP clients, webhooks, URL fetchers, or any feature that connects to an external address.
Why use it?
They reduce the risk of server-side request forgery, where an attacker tricks a server into accessing private services or files.

Cursor rule

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/matank001/cursor-security-rules/ssrf-prevention
Clone the repo
git clone --depth 1 https://github.com/matank001/cursor-security-rules
Per session 351 This file is loaded in full into every session.
When invoked 351 The same file — it is already loaded in full.
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.00351 $0.00351
Opus 5 $0.00176 $0.00176
Sonnet 5 $0.00070 $0.00070
Haiku 4.5 $0.00035 $0.00035

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

Security

Grade A, and why

ssrf-prevention 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 3d 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.

Makes network callslowCapability

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

requests.get(request.args["url"])
Origin

Copies of this mod

2 near-identical copies found in the catalogue:

ssrf-prevention.mdc · 31 lines

What it actually says

SSRF Prevention

These rules apply to all code that performs outbound network requests, regardless of language or framework, including generated code.

All violations must include a clear explanation of which rule was triggered and why, to help developers understand and fix the issue effectively.
Generated code must not violate these rules. If a rule is violated, a comment must be added explaining the issue and suggesting a correction.

1. Do Not Allow User Input to Control Target URLs

  • Rule: Never use raw or unchecked user input as the destination for outbound HTTP requests.
  • Example (unsafe):
    requests.get(request.args["url"])
    

2. Block Access to Private/Internal IP Ranges

  • Rule: Outbound requests must not be allowed to reach localhost, 127.0.0.1, 169.254.0.0/16, 192.168.0.0/16, 10.0.0.0/8, or other internal/reserved ranges.

3. Resolve and Validate Hostnames Before Use

  • Rule: Perform DNS resolution and validate that the resolved IP is in an allowed range before initiating a request.

4. Restrict Allowed Protocols and Ports

  • Rule: Only allow HTTP/HTTPS protocols and known-safe ports (e.g., 80, 443). Block access to file URLs, gopher, FTP, or custom handlers.

5. Do Not Forward Authorization Headers Automatically

  • Rule: Never pass internal tokens, cookies, or auth headers when proxying or forwarding outbound requests unless explicitly scoped and audited.
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. 3d ago First seen · 31 lines · 351 tokens per session scan A 2a7f1d2004fa

Subscribe to this mod's changes

ssrf-prevention is a cursor rule published in the GitHub repository matank001/cursor-security-rules (378 stars, last pushed 1y ago), licensed MIT. It adds 351 tokens to every session, about $0.0018 per session on Opus 5. 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.