

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
12345# Drupal File Permissions Security67Standards for securing Drupal file permissions in Docker environments and production servers, ensuring proper security while maintaining functionality.89## Rule Details1011- **Name:** drupal_file_permissions1213- **Description:** Enforce secure file permissions for Drupal sites/default directory and critical files1415## Filters16- file extension pattern: `\\.(dockerfile|sh|yml)$`17- file name: `^Dockerfile$|^docker-compose\\.yml$`18- content: `(?i)chmod|chown|drupal|settings\\.php|services\\.yml`1920## Enforcement Checks21- Conditions:22 - pattern `chmod\\s+(?!755)\\d+\\s+[^\\n]*sites\\/default(?![^\\n]*files)` – sites/default directory should have 755 permissions (read-only for group/others)23 - pattern `chmod\\s+(?!444)\\d+\\s+[^\\n]*settings\\.php` – settings.php should have 444 permissions (read-only for everyone)24 - pattern `chmod\\s+(?!444)\\d+\\s+[^\\n]*services\\.yml` – services.yml should have 444 permissions (read-only for everyone)25 - pattern `chmod\\s+(?!755)\\d+\\s+[^\\n]*sites\\/default\\/files` – sites/default/files directory should have 755 permissions with proper ownership26 - 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)2728## Suggestions29- Guidance:30## Drupal File Permissions Security Best Practices3132### 1. Critical File Permissions33- **sites/default directory**: 755 (drwxr-xr-x)34- **settings.php**: 444 (r--r--r--)35- **services.yml**: 444 (r--r--r--)36- **settings.local.php**: 444 (r--r--r--)37- **sites/default/files**: 755 (drwxr-xr-x)38- **sites/default/files/** (contents): 644 (rw-r--r--) for files, 755 (drwxr-xr-x) for directories3940### 2. Ownership Configuration41- **Web root**: application user (varies by environment)42- **sites/default/files**: web server user (www-data:www-data)4344### 3. Implementation in Dockerfile45```dockerfile46# Set proper permissions for Drupal47RUN mkdir -p /app/${WEBROOT}/sites/default/files && \48 chown www-data:www-data /app/${WEBROOT}/sites/default/files && \49 chmod 755 /app/${WEBROOT}/sites/default && \50 chmod 444 /app/${WEBROOT}/sites/default/settings.php && \51 chmod 444 /app/${WEBROOT}/sites/default/services.yml && \52 find /app/${WEBROOT}/sites/default/files -type d -exec chmod 755 {} \\; && \53 find /app/${WEBROOT}/sites/default/files -type f -exec chmod 644 {} \\;54```5556### 4. Permission Fix Script57Create a script at `/app/scripts/custom/fix-drupal-permissions.sh`:58```bash59#!/bin/bash6061# Exit on error62set -e6364WEBROOT=${WEBROOT:-web}6566echo "Setting Drupal file permissions..."6768# Ensure directories exist69mkdir -p /app/${WEBROOT}/sites/default/files7071# Set ownership72chown www-data:www-data /app/${WEBROOT}/sites/default/files7374# Set directory permissions75chmod 755 /app/${WEBROOT}/sites/default76chmod 755 /app/${WEBROOT}/sites/default/files77find /app/${WEBROOT}/sites/default/files -type d -exec chmod 755 {} \;7879# Set file permissions80chmod 444 /app/${WEBROOT}/sites/default/settings.php81[ -f /app/${WEBROOT}/sites/default/services.yml ] && chmod 444 /app/${WEBROOT}/sites/default/services.yml82[ -f /app/${WEBROOT}/sites/default/settings.local.php ] && chmod 444 /app/${WEBROOT}/sites/default/settings.local.php83find /app/${WEBROOT}/sites/default/files -type f -exec chmod 644 {} \;8485echo "Drupal file permissions set successfully."86```8788### 5. Verify Permissions89```bash90# Check file permissions91ahoy cli "ls -la /app/${WEBROOT}/sites/default"92ahoy cli "ls -la /app/${WEBROOT}/sites/default/files"9394# Check Drupal status95ahoy drush status-report | grep -i "protected"96```9798### 6. Security Considerations99- Never set 777 permissions on any Drupal files or directories100- Temporary files should be stored in private file system when possible101- Use Drupal's private file system for sensitive uploads102- Implement file access controls through Drupal's permission system103- Consider using file encryption for highly sensitive data104105## Metadata106- Priority: high107- Version: 1.2108109110
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| ivangrynenko/cursorrules.cursor/rules/behat-steps.mdc · 87 | Cursor rules | lint-formatstyleperformanceagent-behaviour | 42/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/confluence-editing-standards.mdc · 87 | Cursor rules | stylearchsecuritydeployment | 60/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/cursor-rules.mdc · 87 | Cursor rules | teststylearchgit+2 | 77/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/debugging-standards.mdc · 87 | Cursor rules | no sections | 30/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-authentication-failures.mdc · 87 | Cursor rules | security | 48/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-broken-access-control.mdc · 87 | Cursor rules | stylesecurity | 52/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-cryptographic-failures.mdc · 87 | Cursor rules | security | 48/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-database-standards.mdc · 87 | Cursor rules | database | 30/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-injection.mdc · 87 | Cursor rules | securitydo-not | 55/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-insecure-design.mdc · 87 | Cursor rules | security | 48/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-integrity-failures.mdc · 87 | Cursor rules | style | 60/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-logging-failures.mdc · 87 | Cursor rules | security | 48/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-security-misconfiguration.mdc · 87 | Cursor rules | security | 48/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-ssrf.mdc · 87 | Cursor rules | style | 52/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-vulnerable-components.mdc · 87 | Cursor rules | stylesecurity | 67/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/git-commit-standards.mdc · 87 | Cursor rules | git | 44/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/github-actions-standards.mdc · 87 | Cursor rules | no sections | 44/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/improve-cursorrules-efficiency.mdc · 87 | Cursor rules | no sections | 34/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/javascript-broken-access-control.mdc · 87 | Cursor rules | securitydo-not | 39/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/javascript-cryptographic-failures.mdc · 87 | Cursor rules | security | 40/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 46 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 14 days ago | |
| bybren-llc/safe-agentic-workflow.cursor/rules/10-backend-python.mdc · 399 | Cursor rules | testlint-formatstylegit+4 | 97/100 | today | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 46 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/project-update-user-rules.mdc · 1.4k | Cursor rules | buildtestlint-formatstyle+7 | 96/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/project-update-rules.mdc · 1.4k | Cursor rules | buildtestlint-formatstyle+7 | 96/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/gh-task-plan.mdc · 1.4k | Cursor rules | teststylearchtypes+2 | 96/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/ivangrynenko-cursorrules-cursor-rules-drupal-file-permissions)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.