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/abderrahimghazali/cursor-rules/javascript-insecure-designgit clone --depth 1 https://github.com/abderrahimghazali/cursor-rulesWhat 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.04533 | $0.04533 |
| Opus 5 | $0.02266 | $0.02266 |
| Sonnet 5 | $0.00907 | $0.00907 |
| Haiku 4.5 | $0.00453 | $0.00453 |
Grade A, and why
javascript-insecure-design 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.
This is a copy
100% identical to javascript-insecure-design — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 492 lines — stays where its author put it; the contents beside it link to each section on GitHub.
description: Detect and prevent insecure design patterns in JavaScript applications as defined in OWASP Top 10:2021-A04 globs: /.js, **/.jsx, /.ts, **/.tsx, !/node_modules/, !/dist/, !/build/, !/coverage/
JavaScript Insecure Design (OWASP A04:2021)
actions:
-
type: enforce conditions:
Pattern 1: Lack of Rate Limiting
- pattern: "app\.(?:get|post|put|delete|patch)\([^)]?\)\s(?!.*(?:rateLimiter|limiter|throttle|rateLimit))" location: "(?:routes|api|controllers)" message: "Potential lack of rate limiting in API endpoint. Consider implementing rate limiting to prevent abuse."
Pattern 2: Insecure Direct Object Reference (IDOR)
- pattern: "(?:findById|getById|findOne)\([^)]?(?:req\.|request\.|params\.|query\.|body\.|user\.|input\.|form\.)[^)]?\)\s*(?!.*(?:authorization|permission|access|canAccess|isAuthorized|checkPermission))" location: "(?:routes|api|controllers)" message: "Potential Insecure Direct Object Reference (IDOR) vulnerability. Implement proper authorization checks before accessing objects by ID."
Pattern 3: Lack of Input Validation
- pattern: "(?:req\.|request\.|params\.|query\.|body\.|user\.|input\.|form\.)[a-zA-Z0-9_]+\s*(?!.*(?:validate|sanitize|check|schema|joi|yup|zod|validator|isValid))" location: "(?:routes|api|controllers)" message: "Potential lack of input validation. Implement proper validation for all user inputs."
Pattern 4: Hardcoded Business Logic
- pattern: "if\s*\([^)]?(?:role\s===\s*['"]admin['"]|isAdmin\s*===\strue|user\.role\s===\s*['"]admin['"])\s*\)" message: "Hardcoded business logic for authorization. Consider using a more flexible role-based access control system."
Pattern 5: Lack of Proper Error Handling
- pattern: "catch\s*\([^)]?\)\s\{[^}]?(?:console\.(?:log|error))[^}]?\}" negative_pattern: "(?:res\.status|next\(err|next\(error|errorHandler)" message: "Improper error handling. Avoid only logging errors without proper handling or user feedback."
Pattern 6: Insecure Authentication Design
- pattern: "(?:password|token|secret|key)\s*===\s*(?:req\.|request\.|params\.|query\.|body\.|user\.|input\.|form\.)" message: "Insecure authentication design. Avoid direct string comparison for passwords or tokens."
Pattern 7: Lack of Proper Logging
- pattern: "app\.(?:get|post|put|delete|patch)\([^)]?\)\s(?!.*(?:log|logger|winston|bunyan|morgan|audit))" location: "(?:routes|api|controllers)" message: "Lack of proper logging in API endpoint. Implement logging for security-relevant events."
Pattern 8: Insecure Defaults
- pattern: "new\s+(?:Session|Cookie|JWT)\([^)]?\{[^}]?(?:secure\s*:\sfalse|httpOnly\s:\sfalse|sameSite\s:\s*['"]none['"])" message: "Insecure default configuration. Avoid setting secure:false, httpOnly:false, or sameSite:'none' for cookies or sessions."
Pattern 9: Lack of Proper Access Control
- pattern: "router\.(?:get|post|put|delete|patch)\([^)]?\)\s(?!.*(?:authenticate|authorize|requireAuth|isAuthenticated|checkAuth|verifyToken|passport\.authenticate))" location: "(?:routes|api|controllers)" message: "Potential lack of access control in route definition. Implement proper authentication and authorization middleware."
Pattern 10: Insecure File Operations
- pattern: "(?:fs\.(?:readFile|writeFile|appendFile|readdir|stat|access|open|unlink)|require)\([^)]?(?:(?:\+|\$\{|\`)[^)]?(?:__dirname|__filename|process\.cwd\(\)|path\.(?:resolve|join)))" negative_pattern: "path\.normalize|path\.resolve|path\.join" message: "Insecure file operations. Use path.normalize() and validate file paths to prevent directory traversal attacks."
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 · 492 lines · 4,533 tokens per session scan A c9992e65cd40
javascript-insecure-design is a cursor rule published in the GitHub repository abderrahimghazali/cursor-rules (2 stars, last pushed 1y ago), licensed MIT. It adds 4,533 tokens to every session, about $0.0227 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to javascript-insecure-design, differing in 0 lines, and is treated as a copy.
Other cursor rules, from other repositories
creating-cursor-rules
Meta-rule for creating effective Cursor IDE rules with best practices, patterns, and examples.
creating-skills
Meta-guide for creating effective Claude Code skills with proper structure, CSO optimization, and real examples.
cursorrules
You are a disciplined senior engineer working with someone who may be a domain expert, not a programmer. Build it correctly and safely, not just fast.
cursorrules
Cursor rule "cursorrules" from BlueBirdBack/godot-cursorrules, covering godot 4.4 game development .cursorrules, core development guidelines, code style, naming conventions and scene organization.
new_feature
You are an expert Product Owner and Technical Lead focused on helping users define and plan new features through collaborative discovery and structured documentation.
new_project
You are an expert Product Owner focused on helping users define new software projects through collaborative vision creation.