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.
npx agentmods add rules/nedcodes-ok/cursor-doctor/securitygit clone --depth 1 https://github.com/nedcodes-ok/cursor-doctorWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00957 | $0.00957 |
| Opus 5 | $0.00478 | $0.00478 |
| Sonnet 5 | $0.00191 | $0.00191 |
| Haiku 4.5 | $0.00096 | $0.00096 |
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.
How it starts
The opening of the file, as written. The whole thing — 45 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Security Rules
Input Validation
- Validate ALL user input on the server — type, length, format, range. Client-side validation is UX, not security
- Allowlists over denylists: define what IS allowed, not what isn't. Denylists always miss something
- Context-aware output encoding: HTML entities for HTML context, parameterized queries for SQL, shell escaping for commands. The same input needs different escaping in different outputs
- Zod, Joi, Pydantic, or similar for structured validation — don't write regex for every field. Schema validation catches entire classes of malformed input at once
- Reject unexpected fields, don't just ignore them. If your API accepts
{ name, email }and receives{ name, email, isAdmin: true }, the extra field should cause an error or be stripped explicitly
Authentication
- bcrypt (cost 12+) or Argon2id for password hashing — never MD5, SHA-256, or single-pass algorithms. If an attacker gets the database, bcrypt makes brute-force take years instead of hours
- Rate limit auth endpoints: 5-10 attempts per IP per minute. After lockout, require CAPTCHA or temporary block — without this, credential stuffing is trivial
- Session cookies:
httpOnly(no JS access),secure(HTTPS only),sameSite: strictorlax(prevents CSRF). Missing any of these is a real vulnerability, not a nice-to-have - Implement actual logout: invalidate the session/token server-side. Just deleting the client cookie means a captured token still works
- JWTs are not sessions: they can't be revoked until they expire. For applications that need instant revocation (admin ban, password change), use server-side sessions or a token blocklist
Authorization
- Check permissions on every request server-side — hiding a button in the UI is not access control. Every API endpoint must verify the caller has permission
- Object-level authorization: verifying a user is authenticated is not enough. Verify they own or have access to the specific resource:
WHERE user_id = auth.uid() AND id = :requestedId - IDOR (Insecure Direct Object Reference) is the most common authorization bug: user changes
/api/orders/123to/api/orders/124and sees someone else's order. Always verify ownership - Fail closed: if the permission check errors or is ambiguous, deny access.
if (!hasPermission) denynotif (hasPermission) allow else maybe allow - Principle of least privilege: give each component/user/service the minimum access it needs. Database users for the app shouldn't have DROP TABLE permissions
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.
- yesterday First seen · 45 lines · 957 tokens per session scan A ff9ffb6717b3
security is a cursor rule published in the GitHub repository nedcodes-ok/cursor-doctor (9 stars, last pushed 5mo ago), licensed MIT. It adds 957 tokens to every session, about $0.0048 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.
Other cursor rules, from other repositories
angular
Angular: signals, standalone components, RxJS patterns.
django
Django: models, views, ORM best practices.
java
Modern Java: records, sealed classes, streams, virtual threads.
javascript
Modern JavaScript: ES2023+, async patterns, common traps.
rust
Rust patterns: ownership, Result types, iterators.
accessibility
Accessibility: semantic HTML, ARIA, keyboard navigation, testing.