agentleFS
kgrizz-gitkgrizz-git/AgentsConfigHelper/.cursor/rules/codeguard-0-data-storage.mdc

AgentsConfigHelper / rules

Cursor rule2 starsChanged 3 months agoMITView on GitHub

Data & storage security (DB isolation, TLS, least privilege, RLS/CLS, backups, auditing)

We split this codeguard-0-data-storage.mdc into the rules it gives an agent

17 rules. About 0 are common, 17 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈17

    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
  1. Distinctive:

    Place database server in separate DMZ isolated from application server.

    line 18
  2. Distinctive:

    Never allow direct connections from thick clients to backend database.

    line 19
  3. Distinctive:

    Use TLSv1.2+ with modern ciphers (AES-GCM, ChaCha20) for client connections.

    line 24
  4. Distinctive:

    Verify digital certificate validity in client applications.

    line 25
  5. Distinctive:

    Ensure all database traffic is encrypted, not just initial authentication.

    line 26
  6. Distinctive:

    Always require authentication, including from local server connections.

    line 29
  7. Distinctive:

    Use dedicated accounts per application or service.

    line 31
  8. Distinctive:

    Remove accounts when applications are decommissioned.

    line 34
  9. Distinctive:

    Never store credentials in application source code.

    line 38
  10. Distinctive:

    Never check credential files into source code repositories.

    line 41
  11. Distinctive:

    Use environment variables or secrets management solutions.

    line 43
  12. Distinctive:

    Do not use built-in root, sa, or SYS accounts.

    line 47
  13. Distinctive:

    Do not grant administrative rights to application accounts.

    line 48
  14. Distinctive:

    Use separate databases and accounts for Development, UAT, and Production.

    line 50
  15. Distinctive:

    Avoid making accounts database owners to prevent privilege escalation.

    line 52
  16. Distinctive:

    Run database services under low-privileged user accounts.

    line 57
  17. Distinctive:

    Remove default accounts and sample databases.

    line 58

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
codeguard-0-data-storage.mdc
---
description: Data & storage security (DB isolation, TLS, least privilege, RLS/CLS, backups, auditing)
globs: **/*.c,**/*.ddl,**/*.dml,**/*.h,**/*.js,**/*.jsx,**/*.mjs,**/*.sql,**/*.yaml,**/*.yml
version: 1.0.1
---

rule_id: codeguard-0-data-storage

## Database Security Guidelines

This rule advises on securely configuring SQL and NoSQL databases to protect against data breaches and unauthorized access:

- Backend Database Protection
  - Isolate database servers from other systems and limit host connections.
  - Disable network (TCP) access when possible; use local socket files or named pipes.
  - Configure database to bind only on localhost when appropriate.
  - Restrict network port access to specific hosts with firewall rules.
  - Place database server in separate DMZ isolated from application server.
  - Never allow direct connections from thick clients to backend database.

- Transport Layer Security
  - Configure database to only allow encrypted connections.
  - Install trusted digital certificates on database servers.
  - Use TLSv1.2+ with modern ciphers (AES-GCM, ChaCha20) for client connections.
  - Verify digital certificate validity in client applications.
  - Ensure all database traffic is encrypted, not just initial authentication.

- Secure Authentication Configuration
  - Always require authentication, including from local server connections.
  - Protect accounts with strong, unique passwords.
  - Use dedicated accounts per application or service.
  - Configure minimum required permissions only.
  - Regularly review accounts and permissions.
  - Remove accounts when applications are decommissioned.
  - Change passwords when staff leave or compromise is suspected.

- Database Credential Storage
  - Never store credentials in application source code.
  - Store credentials in configuration files outside web root.
  - Set appropriate file permissions for credential access.
  - Never check credential files into source code repositories.
  - Encrypt credential storage using built-in functionality when available.
  - Use environment variables or secrets management solutions.

- Secure Permission Management
  - Apply principle of least privilege to all database accounts.
  - Do not use built-in root, sa, or SYS accounts.
  - Do not grant administrative rights to application accounts.
  - Restrict account connections to allowed hosts only.
  - Use separate databases and accounts for Development, UAT, and Production.
  - Grant only required permissions (SELECT, UPDATE, DELETE as needed).
  - Avoid making accounts database owners to prevent privilege escalation.
  - Implement table-level, column-level, and row-level permissions when needed.

- Database Configuration and Hardening
  - Install required security updates and patches regularly.
  - Run database services under low-privileged user accounts.
  - Remove default accounts and sample databases.
  - Store transaction logs on separate disk from main database files.
  - Configure regular encrypted database backups with proper permissions.
  - Disable unnecessary stored procedures and dangerous features.
  - Implement database activity monitoring and alerting.

- Platform-Specific Hardening
  - SQL Server: Disable xp_cmdshell, CLR execution, SQL Browser service, Mixed Mode Authentication (unless required).
  - MySQL/MariaDB: Run mysql_secure_installation, disable FILE privilege for users.
  - PostgreSQL: Follow PostgreSQL security documentation guidelines.
  - MongoDB: Implement MongoDB security checklist requirements.
  - Redis: Follow Redis security guide recommendations.

Summary:
Isolate database systems, enforce encrypted connections, implement strong authentication, store credentials securely using secrets management, apply least privilege permissions, harden database configurations, and maintain regular security updates and monitoring.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.