security

A set of security rules applied whenever code is changed. It covers secrets, untrusted input, injection attacks, output safety, access permissions, and dependencies.

In plain words
What is it for?
Reviewing edits that handle request data, command-line arguments, files, environment variables, authentication, cryptography, databases, HTML output, or external services.
Why use it?
It helps prevent common security mistakes, such as exposing passwords, executing unsafe input, or weakening protections to make a check pass.

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/doidor/agentrig/security
Clone the repo
git clone --depth 1 https://github.com/doidor/agentrig

Made for: Cursor.

Per session 312 This file is loaded in full into every session.
When invoked 312 The same file — it is already loaded in full.
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.00312 $0.00312
Opus 5 $0.00156 $0.00156
Sonnet 5 $0.00062 $0.00062
Haiku 4.5 $0.00031 $0.00031

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

Security

Grade A, and why

security 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/security.mdc · 25 lines

What it actually says

Security rules (reflex)

Apply on every edit. When in doubt, stop and flag rather than guess.

  • No secrets in source. Never commit tokens, keys, passwords, or connection strings. Read them from environment/secret stores. If you spot a committed secret, stop and report it.
  • Validate and sanitize all external input (request bodies, query params, CLI args, file contents, env). Reject/normalize before use.
  • No injection. Use parameterized queries; never string-concatenate SQL/shell/HTML from input. Avoid eval, dynamic require, and shelling out with unsanitized input.
  • Escape on output to prevent XSS; use the framework's escaping, not hand-rolled.
  • Least privilege. Don't broaden file, network, or token scopes to make something work.
  • Don't disable security controls (auth checks, CSRF, TLS verification, lint security rules) to pass a test or unblock a build.
  • Dependencies: prefer maintained, pinned versions; don't add a dependency to avoid a few lines.

If a change touches auth, crypto, or input boundaries, call it out explicitly for review.

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 · 25 lines · 312 tokens per session scan A d95dc944d76d

Subscribe to this mod's changes

security is a cursor rule published in the GitHub repository doidor/agentrig (5 stars, last pushed 1mo ago), licensed MIT. It adds 312 tokens to every session, about $0.0016 per session on Opus 5. 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-31.