agentleFS
ConsensysConsensys/linea-monorepo/.cursor/rules/security-logging-guidelines/RULES.md

linea-monorepo / security-logging-guidelines

Cursor rule126 starsChanged 3 months agoApache-2.0View on GitHub

Security-Sensitive Information Logging Prevention - Rules

  • Reads credentials

We split this RULES.md into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use obviously fake/placeholder credentials in all tests, fixtures, .env.template files, and documentation.

    line 29
  2. Very specific:

    Ensure .env files are in .gitignore and template files reference placeholders only.

    line 30
  3. Distinctive:

    When a violation is detected, block the change with a clear explanation and suggest a safe alternative.

    line 44

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

Security Logging Rules

Refer to EXAMPLES.md for detailed examples of what to do and what not to do.

MUST NOT

  • Log passwords, API keys, auth tokens, session IDs, private keys (cryptographic/SSH/PGP), JWT tokens, AWS keys, or GitHub tokens.
  • Log URLs containing sensitive query parameters (token, apiKey, secret, password, auth) without sanitization.
  • Log environment variables wholesale or config objects without redacting sensitive fields.
  • Log RPC URLs with embedded tokens or database connection strings containing credentials.
  • Log private keys or raw signatures during transaction signing or message signing.
  • Expose secrets in error messages, stack traces, exception propagation, metrics labels, trace data, or health-check endpoints.
  • Hardcode secrets in source code, operation scripts, configuration files, documentation, or code comments.
  • Include real credentials in tests, fixtures, mock servers, Postman collections, or example code.
  • Log request/response bodies or headers that contain auth tokens.

MUST

  • Sanitize URLs by redacting sensitive query parameters before any logging.
  • Redact sensitive fields when logging objects or configuration; override toString() on config classes (Kotlin/Java) to redact secrets.
  • Configure structured logging frameworks (Log4j/SLF4J/etc.) to filter sensitive data.
  • Load secrets from environment variables or secure vaults exclusively.
  • Use obviously fake/placeholder credentials in all tests, fixtures, .env.template files, and documentation.
  • Ensure .env files are in .gitignore and template files reference placeholders only.
  • Sanitize error details before propagation - log error.message and error.code, not full config or request objects.

MAY log

  • Log levels, categories, timestamps, and request IDs.
  • Endpoint paths without query parameters.
  • Error types and status codes.
  • Configuration keys (not values); indicate presence with [CONFIGURED] / [NOT SET].
  • Wallet addresses and transaction hashes (never private keys).
  • Partial identifiers (last 4 characters).

Enforcement

When a violation is detected, block the change with a clear explanation and suggest a safe alternative. Always reference EXAMPLES.md for correct patterns.

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.

Reviews can't be read right now.

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.