drupal-broken-access-control

drupal-broken-access-control is a cursor rule for Cursor from ivangrynenko/cursorrules. It costs 1,342 tokens per session, scanned A, original, MIT.

A Drupal code-checking rule for access control, which decides which users are allowed to reach routes and features.

In plain words
What is it for?
Use it to review custom Drupal modules, themes, and profiles for route permissions and user-access checks.
Why use it?
It helps find missing permission checks, deprecated access methods, and unsafe hardcoded administrator checks that could expose protected actions.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it to review custom Drupal modules, themes, and profiles for route permissions and user-access checks.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/ivangrynenko/cursorrules/drupal-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/ivangrynenko/cursorrules

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 drupal-broken-access-control

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

Your own site · 80×15
<a href="https://agentmods.dev/rules/ivangrynenko/cursorrules/drupal-broken-access-control"><img src="https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/drupal-broken-access-control.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,342 This file is loaded in full into every session.
When invoked 1,342 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.01342 $0.01342
Opus 5.5 $0.00537 $0.00537
Sonnet 5.5 $0.00268 $0.00268
Haiku 4.5 $0.00134 $0.00134

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

Security

Grade A, and why

drupal-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 3mo 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.

.cursor/rules/drupal-broken-access-control.mdc · 91 lines

How it starts

The opening of the file, as written. The whole thing — 91 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Drupal Broken Access Control Security Standards (OWASP A01:2021)

This rule enforces security best practices to prevent broken access control vulnerabilities in Drupal applications, as defined in OWASP Top 10:2021-A01.

Rule Details

  • Name: drupal_broken_access_control

  • Description: Detect and prevent broken access control vulnerabilities in Drupal as defined in OWASP Top 10:2021-A01

Filters

  • file extension pattern: \\.(php|inc|module|install|theme)$
  • file path pattern: (modules|themes|profiles)/custom

Enforcement Checks

  • Conditions:
    • pattern \\s*\\$routes\\['[^']*'\\]\\s*=\\s*.*(?!_access|access_callback|requirements) – Route definition is missing access control. Add '_permission', '_role', '_access', or custom access check in requirements.
      • Pattern 1: Missing access checks in routes
    • pattern user_access\\( – user_access() is deprecated. Use $account->hasPermission() or proper dependency injection with AccessResult methods.
      • Pattern 2: Using user_access() instead of more secure methods
    • pattern (\\$user->id\\(\\)|\\$user->uid)\\s*===?\\s*1 – Avoid hardcoded checks against user ID 1. Use role-based permissions or proper access control services.
      • Pattern 3: Hard-coded user ID checks
    • pattern \\$entity->(?!access)(save|delete|update)\\(\\) – Entity operation without prior access check. Use $entity->access('operation') before performing operations.
      • Pattern 4: Missing access check on entity operations
    • pattern \\\\Drupal::currentUser\\(\\) – Avoid using \Drupal::currentUser() directly. Inject the current_user service for better testability and security.
      • Pattern 5: Using Drupal::currentUser() directly in services
    • pattern class [A-Za-z0-9_]+Controller.+extends ControllerBase[^}]+public function [a-zA-Z0-9_]+\\([^{]*\\)\\s*\\{(?![^}]*access) – Controller method lacks explicit access checking. Add checks via route requirements or within the controller method.
      • Pattern 6: Missing access checks in controllers
    • pattern \\$entity->set\\([^)]+\\)\\s*;(?![^;]*access) – Direct field value manipulation without access check. Verify entity field access before manipulation.
      • Pattern 7: Direct field value manipulation without access check
    • pattern @RestResource\\([^)]*\\)(?![^{]*_access|access_callback) – REST resource lacks access controls. Add access checks via annotations or in methods.
      • Pattern 8: Unprotected REST endpoints
    • pattern \\$_SERVER\\['REMOTE_ADDR'\\]\\s*===?\\s* – IP-based access control is insufficient. Use proper Drupal permission system instead.
      • Pattern 9: Insecure access check by client IP
    • pattern #cache\\['contexts'\\]\\s*=\\s*\\[[^\\]]*'user'[^\\]]*\\] – Using 'user' cache context without proper access checks may expose content to unauthorized users.
      • Pattern 10: Allow bypassing cache for authenticated users without proper checks

Read the full file on GitHub · 91 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. 3mo ago First seen · 91 lines · 1,342 tokens per session scan A ebb4dc03b4cc

Subscribe to this mod's changes

drupal-broken-access-control is a cursor rule published in the GitHub repository ivangrynenko/cursorrules (88 stars, last pushed 1y ago), licensed MIT. It adds 1,342 tokens to every session, about $0.0054 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.

Related

drupal-broken-access-control compared with cursor rules from other repositories

drupal-broken-access-control next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
drupal-broken-access-controlivangrynenko/cursorrulesCursor rule881y agoMITA1,342Cursor
cross-tool-confignedcodes-ok/cursorrules-collectionCursor rule389mo agoMITA24Cursor
angularnedcodes-ok/cursorrules-collectionCursor rule389mo agoMITA988Cursor
djangonedcodes-ok/cursorrules-collectionCursor rule389mo agoMITA1,072Cursor
vuenedcodes-ok/cursorrules-collectionCursor rule389mo agoMITA866Cursor
gonedcodes-ok/cursorrules-collectionCursor rule389mo agoMITA1,028Cursor
javanedcodes-ok/cursorrules-collectionCursor rule389mo agoMITA1,083Cursor