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-broken-access-controlgit 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.04163 | $0.04163 |
| Opus 5 | $0.02082 | $0.02082 |
| Sonnet 5 | $0.00833 | $0.00833 |
| Haiku 4.5 | $0.00416 | $0.00416 |
Grade A, and why
javascript-broken-access-control 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-broken-access-control — 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 — 401 lines — stays where its author put it; the contents beside it link to each section on GitHub.
description: Detect and prevent broken access control patterns in JavaScript applications as defined in OWASP Top 10:2021-A01 globs: /.js, **/.jsx, /.ts, **/.tsx, !/node_modules/, !/dist/, !/build/, !/coverage/
JavaScript Broken Access Control (OWASP A01:2021)
This rule identifies and prevents broken access control vulnerabilities in JavaScript applications, focusing on both browser and Node.js environments, as defined in OWASP Top 10:2021-A01.
actions:
-
type: enforce conditions:
Pattern 1: Detect Direct Reference to User-Supplied IDs (IDOR vulnerability)
- pattern: "(?:req|request)\.(?:params|query|body)\.(?:id|userId|recordId)[^\n]*?(?:findById|getById|find\(|get\()" message: "Potential Insecure Direct Object Reference (IDOR) vulnerability. User-supplied IDs should be validated against user permissions before database access."
Pattern 2: Detect Missing Authorization Checks in Route Handlers
- pattern: "(?:app|router)\.(?:get|post|put|delete|patch)\(['"][^'"]+['"],\s*(?:async)?\s*\(?(?:req|request),\s*(?:res|response)(?:,[^\)]+)?\)?\s*=>\s*\{[^\}]*?\}\)" negative_pattern: "(?:isAuthenticated|isAuthorized|checkPermission|verifyAccess|auth\.check|authenticate|authorize|userHasAccess|checkAuth|permissions\.|requireAuth|requiresAuth|ensureAuth|\bauth\b|\broles?\b|\bpermission\b|\baccess\b)" message: "Route handler appears to be missing authorization checks. Implement proper access control to verify user permissions before processing requests."
Pattern 3: Detect JWT Token Validation Issues
- pattern: "(?:jwt|jsonwebtoken)\.verify\((?:[^,]+),\s*'"['"]" message: "Hardcoded JWT secret detected. Store JWT secrets securely in environment variables or a configuration manager."
Pattern 4: Detect Client-Side Authorization Checks
- pattern: "if\s*\((?:user|currentUser)\.(?:role|isAdmin|hasPermission|can[A-Z][a-zA-Z]+|is[A-Z][a-zA-Z]+)\)\s*\{[^\}]?(?:fetch|axios|\$\.ajax|http\.get|http\.post)\([^\)]?\)" message: "Authorization logic implemented on client-side. Client-side authorization checks can be bypassed. Always enforce authorization on the server."
Pattern 5: Detect Improper CORS Configuration
- pattern: "(?:app\.use\(cors\(\{[^\}]?origin:\s['"]\['"])|Access-Control-Allow-Origin:\s['"]\*['"]" message: "Wildcard CORS policy detected. This allows any domain to make cross-origin requests. Restrict CORS to specific trusted domains."
Pattern 6: Detect Lack of Role Checks in Admin Functions
- pattern: "(?:function|const)\s+(?:admin|updateUser|deleteUser|createUser|updateRole|manageUsers|setPermission)[^\{]?\{[^\}]?\}" negative_pattern: "(?:role|permission|isAdmin|hasAccess|authorize|authenticate|auth\.check|checkPermission|checkRole|verifyRole|ensureAdmin|adminOnly|adminRequired|requirePermission)" message: "Administrative function appears to be missing role or permission checks. Implement proper authorization checks to restrict access to administrative functions."
Pattern 7: Detect Missing Login Rate Limiting
- pattern: "(?:function|const)\s+(?:login|signin|authenticate|auth)[^\{]?\{[^\}]?(?:compare(?:Sync)?|check(?:Password)?|match(?:Password)?|verify(?:Password)?)[^\}]*?\}" negative_pattern: "(?:rate(?:Limit)?|throttle|limit|delay|cooldown|attempt|counter|maxTries|maxAttempts|lockout|timeout)" message: "Login function appears to be missing rate limiting. Implement rate limiting to prevent brute force attacks."
Pattern 8: Detect Horizontal Privilege Escalation Vulnerability
- pattern: "(?:findById|findOne|findByPk|get)\((?:req|request)\.(?:params|query|body)\.(?:id|userId|accountId)\)" negative_pattern: "(?:!=|!==|===|==)\s*(?:req\.user\.id|req\.userId|currentUser\.id|user\.id|session\.userId)" message: "Potential horizontal privilege escalation vulnerability. Ensure the requested resource belongs to the authenticated user."
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 · 401 lines · 4,163 tokens per session scan A 13b61a2e2d5b
javascript-broken-access-control is a cursor rule published in the GitHub repository abderrahimghazali/cursor-rules (2 stars, last pushed 1y ago), licensed MIT. It adds 4,163 tokens to every session, about $0.0208 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to javascript-broken-access-control, 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.