dangerous-flows

A code-review guide for tracing untrusted data through an application and finding dangerous uses that could cause security holes or unexpected behavior.

In plain words
What is it for?
Use it to inspect how user input moves through web, backend, or other code and to test whether each use is safe.
Why use it?
It helps reveal problems such as command injection, server-side request forgery (SSRF), path traversal, and broken access controls before they are missed.

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/dangerous-flows
Clone the repo
git clone --depth 1 https://github.com/matank001/cursor-security-rules
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,891 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 3 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.00014 $0.01891
Opus 5 $0.00007 $0.00945
Sonnet 5 $0.00003 $0.00378
Haiku 4.5 $0.00001 $0.00189

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

Security

Grade C, and why

dangerous-flows scanned grade C with 3 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

exec(`rm -rf ${userInput}`); // Unvalidated input = command injection

Makes network callslowCapability

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

* `fetch()`, `axios.get()`, `requests.get()`, `urllib`, `http.get()`, etc.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

* `exec`, `spawn`, `system`, `popen`, `ProcessBuilder`, `subprocess.run`, etc.
Origin

Copies of this mod

2 near-identical copies found in the catalogue:

dangerous-flows.mdc · 259 lines

How it starts

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

Dangerous Flow Identification

A Dangerous Flow occurs when user input—or data derived from it—is used in a way that introduces vulnerabilities, undefined behavior, or unwanted system interactions. This can range from command injection, SSRF, and path traversal to logic bugs and broken access controls. The goal is to trace the lifecycle of untrusted inputs and assess whether their use is safe.


Starting the Session

  1. If the project is very large, you may ask the user for what specific flow he wishes to test or for where more specific area of the code he is interested in.

Example of Dangerous Flow in JavaScript

const express = require('express');
const fs = require('fs');
const app = express();

app.get('/read', (req, res) => {
  const filename = req.query.file; // User input
  fs.readFile(`/home/userdata/${filename}`, (err, data) => {  // Dangerous usage
    if (err) return res.status(500).send("Error reading file");
    res.send(data);
  });
});

Danger: This allows for Path Traversal (e.g., ?file=../../etc/passwd), enabling unauthorized file access.


Identifying User Inputs

  1. Web/Backend Projects

    • Look for where routes or API endpoints are defined (e.g., Express app.get(), Flask @app.route, FastAPI).
    • Search for request/response objects: req, res, request, ctx, etc.
  2. CLI/Native Applications

    • Look for process.argv, getopt, or direct stdin usage.
    • Watch for file input, env variables, user config, or interactive prompts.
  3. Persisted Inputs

    • Even if sanitized once, data stored in a DB, config, or file can be reused unsafely.
    • These create second-order injection risks.

Following the Flow

  1. Start Point Detection

    • Look for parameters from user input:

      • req.body, req.query, input(), prompt(), fs.readFileSync(userInput), etc.
    • Example:

      username = input("Enter username:")  # user input
      

Read the full file on GitHub · 259 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 · 259 lines · 14 tokens per session scan C 59742e1e4894

Subscribe to this mod's changes

dangerous-flows is a cursor rule published in the GitHub repository matank001/cursor-security-rules (378 stars, last pushed 1y ago), licensed MIT. It adds 14 tokens to every session and 1,891 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it C with 3 findings (recursive force delete, makes network calls, runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.