cursorrules / rules
Cursor rule88 starsChanged 13 months agoMITView on GitHub
Detect and prevent software and data integrity failures in Drupal as defined in OWASP Top 10:2021-A08
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 1,533 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 repository70 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/accessibility-standards.mdcCursor rule
- .cursor/rules/api-standards.mdcCursor rule
- .cursor/rules/behat-ai-guide.mdcCursor rule
- .cursor/rules/behat-steps.mdcCursor rule
- .cursor/rules/build-optimization.mdcCursor rule
- .cursor/rules/code-generation-standards.mdcCursor rule
- .cursor/rules/confluence-editing-standards.mdcCursor rule
- .cursor/rules/cursor-rules.mdcCursor rule
- .cursor/rules/debugging-standards.mdcCursor rule
- .cursor/rules/docker-compose-standards.mdcCursor rule
- .cursor/rules/drupal-authentication-failures.mdcCursor rule
- .cursor/rules/drupal-broken-access-control.mdcCursor rule
- .cursor/rules/drupal-cryptographic-failures.mdcCursor rule
- .cursor/rules/drupal-database-standards.mdcCursor rule
- .cursor/rules/drupal-file-permissions.mdcCursor rule
- .cursor/rules/drupal-injection.mdcCursor rule
- .cursor/rules/drupal-insecure-design.mdcCursor rule
- .cursor/rules/drupal-logging-failures.mdcCursor rule
- .cursor/rules/drupal-security-misconfiguration.mdcCursor rule
- .cursor/rules/drupal-ssrf.mdcCursor rule
- .cursor/rules/drupal-vulnerable-components.mdcCursor rule
- .cursor/rules/generic_bash_style.mdcCursor rule
- .cursor/rules/git-commit-standards.mdcCursor rule
- .cursor/rules/github-actions-standards.mdcCursor rule
- .cursor/rules/improve-cursorrules-efficiency.mdcCursor rule
- .cursor/rules/javascript-broken-access-control.mdcCursor rule
- .cursor/rules/javascript-cryptographic-failures.mdcCursor rule
- .cursor/rules/javascript-identification-authentication-failures.mdcCursor rule
- .cursor/rules/javascript-injection.mdcCursor rule
- .cursor/rules/javascript-insecure-design.mdcCursor rule
- .cursor/rules/javascript-performance.mdcCursor rule
- .cursor/rules/javascript-security-logging-monitoring-failures.mdcCursor rule
- .cursor/rules/javascript-security-misconfiguration.mdcCursor rule
- .cursor/rules/javascript-server-side-request-forgery.mdcCursor rule
- .cursor/rules/javascript-software-data-integrity-failures.mdcCursor rule
- .cursor/rules/javascript-standards.mdcCursor rule
- .cursor/rules/javascript-vulnerable-outdated-components.mdcCursor rule
- .cursor/rules/lagoon-docker-compose-standards.mdcCursor rule
- .cursor/rules/lagoon-yml-standards.mdcCursor rule
- .cursor/rules/multi-agent-coordination.mdcCursor rule
- .cursor/rules/new-pull-request.mdcCursor rule
- .cursor/rules/node-dependencies.mdcCursor rule
- .cursor/rules/php-drupal-best-practices.mdcCursor rule
- .cursor/rules/php-drupal-development-standards.mdcCursor rule
- .cursor/rules/php-memory-optimisation.mdcCursor rule
- .cursor/rules/project-definition-template.mdcCursor rule
- .cursor/rules/pull-request-changelist-instructions.mdcCursor rule
- .cursor/rules/python-authentication-failures.mdcCursor rule
- .cursor/rules/python-broken-access-control.mdcCursor rule
- .cursor/rules/python-cryptographic-failures.mdcCursor rule
- .cursor/rules/python-injection.mdcCursor rule
- .cursor/rules/python-insecure-design.mdcCursor rule
- .cursor/rules/python-integrity-failures.mdcCursor rule
- .cursor/rules/python-logging-monitoring-failures.mdcCursor rule
- .cursor/rules/python-security-misconfiguration.mdcCursor rule
- .cursor/rules/python-ssrf.mdcCursor rule
- .cursor/rules/python-vulnerable-outdated-components.mdcCursor rule
- .cursor/rules/react-patterns.mdcCursor rule
- The first 60 shown.
The file
Show its rules and text
We split this drupal-integrity-failures.mdc into the rules it gives an agent
14 rules. About 0 are common, 14 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
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 48
Avoid PHP's unserialize() with untrusted data entirely
- Distinctive: line 49
Use JSON or other structured formats for data interchange
- Distinctive: line 50
When deserialization is necessary, implement allowlists and validation
- Distinctive: line 51
Consider using Drupal's typed data API for structured data handling
- Distinctive: line 52
Avoid serializing sensitive data that could be tampered with
- Distinctive: line 57
Use Drupal's Configuration Management system properly
- Distinctive: line 62
Verify the integrity of downloaded modules and themes
- Distinctive: line 63
Use Composer with package signature verification
- Distinctive: line 70
Verify signatures during deployment
- Distinctive: line 76
Use database constraints to enforce data integrity
- Distinctive: line 78
Add integrity checks for critical data flows
- Distinctive: line 85
Check 1: Secure serialization alternatives
- Distinctive: line 87
Check 2: Proper entity validation
- Distinctive: line 91
Check 4: Safe file handling
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 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: Detect and prevent software and data integrity failures in Drupal as defined in OWASP Top 10:2021-A08
globs: *.php, *.install, *.module, *.inc, *.theme, *.yml, *.json
alwaysApply: false
---
# Drupal Software and Data Integrity Failures Standards (OWASP A08:2021)
This rule enforces security best practices to prevent software and data integrity failures in Drupal applications, as defined in OWASP Top 10:2021-A08.
## Rule Details
- **Name:** drupal_integrity_failures
- **Description:** Detect and prevent software and data integrity failures in Drupal as defined in OWASP Top 10:2021-A08
## Filters
- file extension pattern: `\\.(php|inc|module|install|theme|yml|json)$`
- file path pattern: `.*`
## Enforcement Checks
- Conditions:
- pattern `unserialize\\(\\$|unserialize\\([^,]+\\$|php_unserialize\\(\\$` – Insecure PHP deserialization detected. Use safer alternatives like JSON for data interchange or implement proper validation before deserialization.
- Pattern 1: Insecure deserialization
- pattern `eval\\(|assert\\(|create_function\\(` – Potentially dangerous code execution function detected. Avoid dynamic code execution whenever possible.
- Pattern 2: Unsafe use of eval or similar functions
- pattern `module_load_include\\(\\$|require(_once)?\\s*\\(\\s*\\$|include(_once)?\\s*\\(\\s*\\$` – Dynamic inclusion of files based on user input is dangerous. Use validated, allowlisted paths only.
- Pattern 3: Insecure plugin/module loading
- pattern `update\\.settings\\.yml|function [a-zA-Z0-9_]+_update_[0-9]+\\(\\)` – Ensure update hooks validate the integrity of updates and data transformations to prevent unauthorized modifications.
- Pattern 4: Missing update verification
- pattern `ConfigImporter|\\$config_importer|config_import|cmci` – Validate configuration before import to ensure integrity and detect potentially malicious changes.
- Pattern 5: Unsafe configuration imports
- pattern `drupal_http_request\\(|\\\\Drupal::httpClient\\(\\)->get\\(|curl_exec\\(` – Always validate data from remote sources before processing or storing it. Implement integrity checks for remote content.
- Pattern 6: Unchecked remote data
- pattern `composer\\.json` – Verify you're using secure Composer practices: validate package signatures, pin dependencies, and use composer.lock.
- Pattern 7: Insecure Composer usage
- pattern `INSERT\\s+INTO|UPDATE\\s+[a-zA-Z0-9_]+\\s+SET|db_update\\(|->update\\(|->insert\\(` – Direct database modifications should implement validation to preserve data integrity. Prefer using entity API.
- Pattern 8: Direct database modifications
- pattern `file_save_data\\(|file_save_upload\\(|file_copy\\(|file_move\\(` – Implement file integrity checking for uploaded or manipulated files to prevent malicious content.
- Pattern 9: Missing file integrity verification
- pattern `\\$entity\\s*=\\s*new\\s+[A-Za-z]+\\(|::create\\(\\$` – Validate all input used to create entity objects to maintain data integrity and prevent creating malicious entities.
- Pattern 10: Unsafe entity creation
## Suggestions
- Guidance:
**Drupal Data & Software Integrity Best Practices:**
1. **Secure Deserialization:**
- Avoid PHP's unserialize() with untrusted data entirely
- Use JSON or other structured formats for data interchange
- When deserialization is necessary, implement allowlists and validation
- Consider using Drupal's typed data API for structured data handling
- Avoid serializing sensitive data that could be tampered with
2. **Update & Configuration Integrity:**
- Validate data before and after migrations/updates
- Implement checksums/hashing for critical configuration
- Use Drupal's Configuration Management system properly
- Monitor configuration changes for unauthorized modifications
- Implement proper workflow for configuration management
3. **Dependency & Plugin Security:**
- Verify the integrity of downloaded modules and themes
- Use Composer with package signature verification
- Pin dependencies to specific versions in production
- Maintain awareness of security advisories
- Implement proper validation for plugin/module loading
4. **CI/CD Pipeline Security:**
- Sign build artifacts
- Verify signatures during deployment
- Implement proper secrets management
- Control access to build and deployment systems
- Validate code changes through code reviews
5. **Data Integrity Validation:**
- Use database constraints to enforce data integrity
- Implement validation at every layer of the application
- Add integrity checks for critical data flows
- Maintain audit logs for data modifications
- Regularly verify data consistency
## Validation Checks
- Conditions:
- pattern `json_encode|json_decode|\\\\Drupal::service\\('serialization\\.|->toArray\\(\\)` – Using safer serialization alternatives.
- Check 1: Secure serialization alternatives
- pattern `\\$entity->validate\\(\\)|\\$violations\\s*=\\s*\\$entity->validate\\(\\)` – Properly validating entity data.
- Check 2: Proper entity validation
- pattern `::validateSyncedConfig\\(|ConfigImporter::validate|->getUnprocessedConfiguration\\(\\)` – Implementing configuration validation.
- Check 3: Config verification
- pattern `file_validate_|FileValidatorInterface|\\$validators` – Using file validation mechanisms.
- Check 4: Safe file handling
## Metadata
- Priority: high
- Version: 1.1
- Tags: security, drupal, integrity, deserialization, owasp, language:php, framework:drupal, category:security, subcategory:integrity, standard:owasp-top10, risk:a08-integrity-failures
## References
- https://owasp.org/Top10/A08_2021-Software_and_Data_Integrity_Failures/
- https://www.drupal.org/docs/develop/security-in-drupal/drupal-8-sanitizing-output
- https://www.drupal.org/docs/8/api/configuration-api/configuration-api-overview
- https://www.drupal.org/docs/develop/using-composer
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.

