drupal-file-permissions

drupal-file-permissions is a cursor rule for Cursor from ivangrynenko/cursorrules. It costs 1,097 tokens per session, scanned A, original, MIT.

Security rules for file permissions in Drupal sites running in Docker or on production servers. Drupal is software for building and managing websites.

In plain words
What is it for?
It checks permissions and ownership for Drupal's settings, service configuration, and uploaded-files directories.
Why use it?
It helps prevent sensitive configuration files from being writable or incorrectly owned.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit It checks permissions and ownership for Drupal's settings, service configuration, and uploaded-files directories.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/rules/ivangrynenko/cursorrules/drupal-file-permissions"><img src="https://agentmods.dev/badge/rules/ivangrynenko/cursorrules/drupal-file-permissions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,097 This file is loaded in full into every session.
When invoked 1,097 The same file — it is already loaded in full.
Security scan A 1 finding. 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.01097 $0.01097
Opus 5.5 $0.00439 $0.00439
Sonnet 5.5 $0.00219 $0.00219
Haiku 4.5 $0.00110 $0.00110

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

Security

Grade A, and why

drupal-file-permissions scanned grade A with 1 finding 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.

Asks for rootlowPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

chmod 755 /app/${WEBROOT}/sites/default && \

Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.

.cursor/rules/drupal-file-permissions.mdc · 110 lines

How it starts

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

Drupal File Permissions Security

Standards for securing Drupal file permissions in Docker environments and production servers, ensuring proper security while maintaining functionality.

Rule Details

  • Name: drupal_file_permissions

  • Description: Enforce secure file permissions for Drupal sites/default directory and critical files

Filters

  • file extension pattern: \\.(dockerfile|sh|yml)$
  • file name: ^Dockerfile$|^docker-compose\\.yml$
  • content: (?i)chmod|chown|drupal|settings\\.php|services\\.yml

Enforcement Checks

  • Conditions:
    • pattern chmod\\s+(?!755)\\d+\\s+[^\\n]*sites\\/default(?![^\\n]*files) – sites/default directory should have 755 permissions (read-only for group/others)
    • pattern chmod\\s+(?!444)\\d+\\s+[^\\n]*settings\\.php – settings.php should have 444 permissions (read-only for everyone)
    • pattern chmod\\s+(?!444)\\d+\\s+[^\\n]*services\\.yml – services.yml should have 444 permissions (read-only for everyone)
    • pattern chmod\\s+(?!755)\\d+\\s+[^\\n]*sites\\/default\\/files – sites/default/files directory should have 755 permissions with proper ownership
    • pattern chown\\s+(?!www-data:www-data)[^\\s]+\\s+[^\\n]*sites\\/default\\/files – sites/default/files should be owned by the web server user (www-data:www-data)

Suggestions

  • Guidance:

Drupal File Permissions Security Best Practices

1. Critical File Permissions

  • sites/default directory: 755 (drwxr-xr-x)
  • settings.php: 444 (r--r--r--)
  • services.yml: 444 (r--r--r--)
  • settings.local.php: 444 (r--r--r--)
  • sites/default/files: 755 (drwxr-xr-x)
  • sites/default/files/ (contents): 644 (rw-r--r--) for files, 755 (drwxr-xr-x) for directories

2. Ownership Configuration

  • Web root: application user (varies by environment)
  • sites/default/files: web server user (www-data:www-data)

3. Implementation in Dockerfile

# Set proper permissions for Drupal
RUN mkdir -p /app/${WEBROOT}/sites/default/files && \
    chown www-data:www-data /app/${WEBROOT}/sites/default/files && \
    chmod 755 /app/${WEBROOT}/sites/default && \
    chmod 444 /app/${WEBROOT}/sites/default/settings.php && \
    chmod 444 /app/${WEBROOT}/sites/default/services.yml && \
    find /app/${WEBROOT}/sites/default/files -type d -exec chmod 755 {} \\; && \
    find /app/${WEBROOT}/sites/default/files -type f -exec chmod 644 {} \\;

Read the full file on GitHub · 110 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 · 110 lines · 1,097 tokens per session scan A d1c22b438f2d

Subscribe to this mod's changes

drupal-file-permissions is a cursor rule published in the GitHub repository ivangrynenko/cursorrules (88 stars, last pushed 11mo ago), licensed MIT. It adds 1,097 tokens to every session, about $0.0044 per session on Opus 5.5. A static security scan graded it A with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.