javascript-broken-access-control

javascript-broken-access-control is a cursor rule for Cursor from abderrahimghazali/cursor-rules. It costs 4,163 tokens per session, scanned A, a copy of javascript-broken-access-control, MIT.

Security rules for finding broken access control in JavaScript and TypeScript applications, based on the OWASP A01 security category.

In plain words
What is it for?
Use it to review browser or Node.js code for unsafe user-supplied IDs, missing authorization checks, and related route-handler problems.
Why use it?
They help detect cases where users can access records or routes without the required permission, including attacks using another user's ID.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to review browser or Node.js code for unsafe user-supplied IDs, missing authorization checks, and related route-handler problems.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/abderrahimghazali/cursor-rules/javascript-broken-access-control
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.

Clone the repo
git clone --depth 1 https://github.com/abderrahimghazali/cursor-rules

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for javascript-broken-access-control

README.md
[![agentmods](https://agentmods.dev/badge/rules/abderrahimghazali/cursor-rules/javascript-broken-access-control/github.svg)](https://agentmods.dev/rules/abderrahimghazali/cursor-rules/javascript-broken-access-control)
Your own site
<a href="https://agentmods.dev/rules/abderrahimghazali/cursor-rules/javascript-broken-access-control"><img src="https://agentmods.dev/badge/rules/abderrahimghazali/cursor-rules/javascript-broken-access-control/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for javascript-broken-access-control

Your own site · 80×15
<a href="https://agentmods.dev/rules/abderrahimghazali/cursor-rules/javascript-broken-access-control"><img src="https://agentmods.dev/badge/rules/abderrahimghazali/cursor-rules/javascript-broken-access-control.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,163 This file is loaded in full into every session.
When invoked 4,163 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod 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.1 $0.04163 $0.04163
Opus 5.5 $0.01665 $0.01665
Sonnet 5.5 $0.00833 $0.00833
Haiku 4.5 $0.00416 $0.00416

Measured 1mo ago against content hash 13b61a2e2d5b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 1mo 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.

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.

Origin

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.

.cursor/rules/javascript-broken-access-control.mdc · 401 lines

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."

Read the full file on GitHub · 401 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. 1mo ago First seen · 401 lines · 4,163 tokens per session scan A 13b61a2e2d5b

Subscribe to this mod's changes

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.0167 per session on Opus 5.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.