AgentsConfigHelper / rules
Cursor rule2 starsChanged 3 months agoMITView on GitHub
Authorization and access control (RBAC/ABAC/ReBAC, IDOR, mass assignment, transaction auth)
We split this codeguard-0-authorization-access-control.mdc into the rules it gives an agent
6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Prefer ABAC/ReBAC over RBAC: Use Attribute-Based Access Control (ABAC) or Relationship-Based Access Control (ReBAC) for fine-grained …
- Distinctive: line 26
Never trust user-supplied identifiers alone.
- Distinctive: line 28
Use non-enumerable identifiers (UUIDs/random) as defense-in-depth.
- Distinctive: line 31
Do not bind request bodies directly to domain objects containing sensitive fields.
- Distinctive: line 33
Use framework features to block-list sensitive fields if allow-listing is infeasible.
- Distinctive: line 37
Use unique, time‑limited authorization credentials per transaction.
≈ “Common” is an estimate: at least 1 in 5 of the 6,350 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
--- description: Authorization and access control (RBAC/ABAC/ReBAC, IDOR, mass assignment, transaction auth) globs: **/*.c,**/*.go,**/*.h,**/*.java,**/*.js,**/*.jsx,**/*.mjs,**/*.php,**/*.py,**/*.pyi,**/*.pyx,**/*.rb,**/*.ts,**/*.tsx,**/*.yaml,**/*.yml version: 1.0.1 --- rule_id: codeguard-0-authorization-access-control ## Authorization & Access Control Enforce least privilege and precise access decisions for every request and resource, prevent IDOR and mass assignment, and provide strong transaction authorization where necessary. ### Core Principles 1. Deny by Default: The default for any access request should be 'deny'. Explicitly grant permissions to roles or users rather than explicitly denying them. When no allow rule matches, return HTTP 403 Forbidden. 2. Principle of Least Privilege: Grant users the minimum level of access required to perform their job functions. Regularly audit permissions to ensure they are not excessive. 3. Validate Permissions on Every Request: Check authorization for every single request, regardless of source (AJAX, API, direct). Use middleware/filters to ensure consistent enforcement. 4. Prefer ABAC/ReBAC over RBAC: Use Attribute-Based Access Control (ABAC) or Relationship-Based Access Control (ReBAC) for fine-grained permissions instead of simple role-based access control. ### Systemic Controls - Centralize authorization at service boundaries via middleware/policies/filters. - Model permissions at the resource level (ownership/tenancy) and enforce scoping in data queries. - Return generic 403/404 responses to avoid leaking resource existence. - Log all denials with user, action, resource identifier (non-PII), and rationale code. ### Preventing IDOR - Never trust user-supplied identifiers alone. Always verify access to each object instance. - Resolve resources through user-scoped queries or server-side lookups. Example: `currentUser.projects.find(id)` instead of `Project.find(id)`. - Use non-enumerable identifiers (UUIDs/random) as defense-in-depth. Do not rely on obscurity alone. ### Preventing Mass Assignment - Do not bind request bodies directly to domain objects containing sensitive fields. - Expose only safe, editable fields via DTOs. Maintain explicit allow-lists for patch/update. - Use framework features to block-list sensitive fields if allow-listing is infeasible. ### Transaction Authorization (Step-Up) - Require a second factor for sensitive actions (wire transfers, privilege elevation, data export). Apply What‑You‑See‑Is‑What‑You‑Sign: show critical fields for user confirmation. - Use unique, time‑limited authorization credentials per transaction; reject on data changes mid‑flow. - Enforce the chosen authorization method server-side; prevent client‑side downgrades. - Protect against brute-force with throttling and complete flow restarts after failures. ### Testing and Automation - Maintain an authorization matrix (YAML/JSON) listing endpoints/resources, roles/attributes, and expected outcomes. - Automate integration tests that iterate the matrix, mint role tokens, and assert allow/deny results—including token expiry/revocation cases. - Exercise negative tests: swapped IDs, downgraded roles, missing scopes, and bypass attempts. ### Implementation Checklist - Middleware/policies enforce deny-by-default and resource checks on every endpoint. - Query scoping ensures users only access permitted rows/objects. - DTOs and allow-lists prevent mass assignment; sensitive fields never bindable. - Step-up authorization in place for sensitive operations with unique, short-lived credentials. - Authorization matrix drives CI tests; failures block merges.
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 3,978 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository24 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/codeguard-0-additional-cryptography.mdcCursor rule
- .cursor/rules/codeguard-0-api-web-services.mdcCursor rule
- .cursor/rules/codeguard-0-authentication-mfa.mdcCursor rule
- .cursor/rules/codeguard-0-client-side-web-security.mdcCursor rule
- .cursor/rules/codeguard-0-cloud-orchestration-kubernetes.mdcCursor rule
- .cursor/rules/codeguard-0-data-storage.mdcCursor rule
- .cursor/rules/codeguard-0-devops-ci-cd-containers.mdcCursor rule
- .cursor/rules/codeguard-0-file-handling-and-uploads.mdcCursor rule
- .cursor/rules/codeguard-0-framework-and-languages.mdcCursor rule
- .cursor/rules/codeguard-0-iac-security.mdcCursor rule
- .cursor/rules/codeguard-0-input-validation-injection.mdcCursor rule
- .cursor/rules/codeguard-0-logging.mdcCursor rule
- .cursor/rules/codeguard-0-mobile-apps.mdcCursor rule
- .cursor/rules/codeguard-0-privacy-data-protection.mdcCursor rule
- .cursor/rules/codeguard-0-safe-c-functions.mdcCursor rule
- .cursor/rules/codeguard-0-session-management-and-cookies.mdcCursor rule
- .cursor/rules/codeguard-0-supply-chain-security.mdcCursor rule
- .cursor/rules/codeguard-0-xml-and-serialization.mdcCursor rule
- .cursor/rules/codeguard-1-crypto-algorithms.mdcCursor rule
- .cursor/rules/codeguard-1-digital-certificates.mdcCursor rule
- .cursor/rules/codeguard-1-hardcoded-credentials.mdcCursor rule
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

