agentleFS
d-o-hubd-o-hub/github-template-ai-agents/.agents/skills/secrets-management/SKILL.md

secrets-management

Skill2 starsChanged 11 days agoMITView on GitHub

Own the secret lifecycle: detect leaked secrets, rotate them, and store them correctly. Use when handling API keys, tokens, or credentials — even if they just say "rotate this key", "where do I put this secret", or "this key is hardcoded". Not for privacy-first (email/PII lint), local prompt/context sanitization before external forwarding (use local-context-sanitization), general vulnerability audits (use security-code-auditor), or commit/PR lifecycle mechanics (use git-github-workflow).

  • Reads credentials

33 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use background-jobs, input-validation and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • YepAPISkill

    background-jobs

    Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

    Also in 3 projects that use this

  • hereshecodesSkill

    input-validation

    Use when processing user input, form data, file uploads, or query parameters

    Also in 3 projects that use this

  • mattpartidaSkill

    agent-security

    Review and harden OpenClaw/Hermes agent security, including tool permissions, elevated access, exec approvals, allowlists, sandboxing, browser and web exposure, prompt-injection risk, model risk, persistence, and personal-vs-shared trust boundaries. Use when the task is primarily about agent or runtime security rather than host firewall or OS hardening.

    Also in 3 projects that use this

  • harperaaSkill

    rate-limiting

    Implement rate limiting to prevent brute force attacks, spam, and resource abuse. Use this skill when you need to protect endpoints from automated attacks, prevent API abuse, limit request frequency, or control infrastructure costs. Triggers include "rate limiting", "rate limit", "brute force", "prevent spam", "API abuse", "resource exhaustion", "DoS", "withRateLimit", "too many requests", "429 error".

    Also in 3 projects that use this

  • jefflesterSkill

    api-security

    API security best practices and common vulnerability prevention. Enforces security checks for authentication, input validation, SQL injection, XSS, and OWASP Top 10 vulnerabilities. Use when building or modifying APIs.

    Also in 4 projects that use this

  • MicrosoftSkill

    supply-chain-security

    Activate when reviewing or modifying dependency resolution, lockfile schema, package downloaders, signature/integrity checks, file integration cleanup, or anything that could expose APM to dependency confusion, typosquatting, malicious packages, or token leakage.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 31 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Never print a secret, even redacted-partially, into logs or PR comments.

    line 40
  2. Very specific:

    Never echo a secret value back, even if the user pasted it into the conversation or asks for a copy "for debugging".

    line 41
  3. Distinctive:

    Never commit a "test" secret that resembles a real one.

    line 44
  4. Distinctive:

    Keep secret-bearing files outside any tree the agent may touch.

    line 68

“Common” is measured: kept by at least 6 in 10 of the 31 edited versions of this file we could read. “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
SKILL.md

Secrets Management

Detect, rotate, and store secrets. A leaked secret is an incident: revoke first, clean history second, prevent third.

When to Use

  • Suspected or confirmed leaked API key, token, or credential
  • Choosing where a secret lives (env, manager, vault, CI secrets)
  • Rotating keys on schedule or offboarding
  • Reviewing code that handles secrets

Steps

  1. Detect — scan with gitleaks; treat any hit as live until proven otherwise. Check history too (git log -S), not just HEAD.
  2. Revoke first — rotate at the provider before cleaning the repo. A cleaned repo with a live leaked key is still an incident.
  3. Clean — purge from history if needed; confirm with a rescan.
  4. Store correctly — env vars or a secret manager; CI secrets for pipelines; never hardcoded, never in docs or chat logs.
  5. Prevent — pre-commit hooks (gitleaks), least-privilege scopes, short TTLs, and rotation reminders.

Rules

  • Never print a secret, even redacted-partially, into logs or PR comments.
  • Never echo a secret value back, even if the user pasted it into the conversation or asks for a copy "for debugging". Offer the reference name (STRIPE_SECRET_KEY) or the command to fetch it instead.
  • Never commit a "test" secret that resembles a real one.
  • Separate secret values from secret references in every example.

Filenames Are Not the Boundary

A tool that reads or writes paths supplied by an agent needs one real control: containment. Resolve the path, then assert it is still inside the allowed base.

base = base.resolve()
candidate = (base / raw).resolve()
candidate.relative_to(base)   # raises => escapes the base => reject

That is default-deny and holds for every file format that exists tomorrow.

A credential-filename denylist (.pem, .tfvars, .sops.yml, .age, …) is a name policy layered on top of it. It only ever decides "which in-base names to also refuse", so it cannot be complete: each new keystore, VPN bundle, or secret-manager file format is another bypass nobody listed. Track such a list's history before trusting it — this template grew one over 36 separate commits and it is still appending.

So, in priority order:

  1. Keep secret-bearing files outside any tree the agent may touch. Enforceable today.
  2. Contain paths with resolve() + relative_to(). Enforceable today.
  3. Denylist known credential filenames. Defense in depth only; expect gaps by design.

Severity follows the layer. A missing extension in layer 3, while layers 1-2 hold, is Low/Medium housekeeping — not a Critical leak. Reserve escalation for a hole in layer 1 or 2, and do not let a per-extension patch inflate into an urgent security incident.

Rationalizations

RationalizationReality
"It's just a test key, safe to commit"Test-shaped keys get copied into production and scraped by bots within minutes.
"I'll rotate it later, let me push the fix first"Every minute a leaked key stays live is exploitation window; revoke before anything else.
"We block every known credential extension"A known-set is complete up to the day a new format ships. Containment does not depend on the extension.

Red Flags

  • Secret value visible in terminal output, logs, or review comments
  • Rotation postponed past the current session
  • New hardcoded credential in any file, including tests and examples
  • A secret file left inside a tree the agent may read, protected only by its filename
  • Another per-extension denylist PR labelled a critical security fix

See Also

  • security-code-auditor — Audit code for vulnerabilities
  • privacy-first — Keep emails and PII out of the codebase
  • local-context-sanitization — Sanitize prompt context before external forwarding
  • git-github-workflow — Pre-commit secret scanning in the lifecycle

References

  • evals/evals.json — leak-response cases incl. live-key negative

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.