javascript-insecure-design

javascript-insecure-design is a cursor rule for Cursor from ivangrynenko/cursorrules. It costs 4,533 tokens per session, scanned A, original, MIT.

A set of JavaScript security checks based on OWASP A04, the category for unsafe application design.

In plain words
What is it for?
It is for reviewing routes, APIs, and controllers for possible design weaknesses including IDOR, where a user accesses another object's data by changing an identifier.
Why use it?
It helps reveal patterns such as missing rate limits, weak access checks, and unvalidated user input that can expose an application to abuse.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is const baseDir = path.resolve(__dirname, '../public/files');.

Good fit It is for reviewing routes, APIs, and controllers for possible design weaknesses including IDOR, where a user accesses another object's data by changing an identifier.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/ivangrynenko/cursorrules
agentmods
npx agentmods add rules/ivangrynenko/cursorrules/javascript-insecure-design

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-insecure-design

README.md
[![agentmods](https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/javascript-insecure-design/github.svg)](https://agentmods.dev/rules/ivangrynenko/cursorrules/javascript-insecure-design)
Your own site
<a href="https://agentmods.dev/rules/ivangrynenko/cursorrules/javascript-insecure-design"><img src="https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/javascript-insecure-design/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-insecure-design

Your own site · 80×15
<a href="https://agentmods.dev/rules/ivangrynenko/cursorrules/javascript-insecure-design"><img src="https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/javascript-insecure-design.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,533 This file is loaded in full into every session.
When invoked 4,533 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 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.1 $0.04533 $0.04533
Opus 5.5 $0.01813 $0.01813
Sonnet 5.5 $0.00907 $0.00907
Haiku 4.5 $0.00453 $0.00453

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

Security

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

Copies of this mod

1 near-identical copy found in the catalogue:

.cursor/rules/javascript-insecure-design.mdc · 492 lines

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.

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

    Pattern 11: Lack of Proper Secrets Management

    • pattern: "(?:apiKey|secret|password|token|credentials)\s*=\s*(?:process\.env\.[A-Z_]+|config\.[a-zA-Z0-9_]+|['"][^'"]+['"])" negative_pattern: "(?:vault|secretsManager|keyVault|secretClient)" message: "Insecure secrets management. Consider using a dedicated secrets management solution instead of environment variables or configuration files."

Read the full file on GitHub · 492 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 · 492 lines · 4,533 tokens per session scan A c9992e65cd40

Subscribe to this mod's changes

javascript-insecure-design is a cursor rule published in the GitHub repository ivangrynenko/cursorrules (88 stars, last pushed 11mo ago), licensed MIT. It adds 4,533 tokens to every session, about $0.0181 per session on Opus 5.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-30.