agentleFS
autheggauthegg/agent-skills/skills/secrets-management/SKILL.md

secrets-management

Skill2 starsChanged 9 months agoMITView on GitHub

Enforce secrets management best practices for containers and cloud-native applications. Use when configuring environment variables, Docker secrets, Kubernetes secrets, Vault integration, AWS SSM/Secrets Manager, or any credential handling in Dockerfiles, compose files, Kubernetes manifests, or CI pipelines. Activates on keywords like "secrets", "credentials", "API key", "password", "environment variables", ".env file", "Vault", "sealed secrets", or "secret manager".

  • Reads credentials

40 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use input-validation, background-jobs 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.
  • hereshecodesSkill

    input-validation

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

    Also in 3 projects that use this

  • YepAPISkill

    background-jobs

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

    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

  • 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

  • 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

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

  • 0

    Common

    Most of the 38 edited versions we read keep these.

  • 6

    Distinctive

    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
  • could be automatic: a setting could enforce it
  1. Distinctive:

    When the user mentions "API key", "password", "token", "credentials", ".env", or "secrets"

    line 18
  2. Distinctive:

    NEVER: put secrets in Dockerfiles (ENV, ARG, or COPY)

    line 22
  3. Distinctive:

    NEVER: commit secrets to version control

    line 23
  4. Distinctive:

    ALWAYS: use the principle of least privilege for secret access

    line 27
  5. Distinctive:

    Add to every pipeline:

    line 157
  6. Distinctive:

    Every project must exclude:

    line 172

“Common” is measured: kept by at least 6 in 10 of the 38 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

Enforce secure secrets handling across Docker, Kubernetes, and CI/CD environments. Prevent credential leaks at every stage of the container lifecycle.

When to Use

  • Configuring environment variables in Dockerfiles or compose files
  • Setting up Kubernetes Secrets or external secret operators
  • Integrating with HashiCorp Vault, AWS Secrets Manager, or similar
  • Reviewing code for hardcoded credentials
  • Setting up CI/CD pipeline secrets
  • When the user mentions "API key", "password", "token", "credentials", ".env", or "secrets"

Cardinal Rules

  1. NEVER put secrets in Dockerfiles (ENV, ARG, or COPY)
  2. NEVER commit secrets to version control
  3. NEVER pass secrets via command-line arguments (visible in process lists)
  4. NEVER log secrets — scrub them from output
  5. ALWAYS rotate secrets regularly
  6. ALWAYS use the principle of least privilege for secret access

Where Secrets Should NOT Be

Dockerfiles — NEVER do this

# ❌ ALL of these are wrong
ENV DATABASE_URL=postgres://user:password@host/db
ARG API_KEY=sk-abc123
COPY .env /app/.env
RUN echo "password" > /app/config

docker-compose — NEVER do this

# ❌ Wrong
services:
  app:
    environment:
      - DB_PASSWORD=mysecretpassword
      - API_KEY=sk-abc123

Kubernetes — NEVER do this

# ❌ Wrong — plaintext in manifest
env:
  - name: DB_PASSWORD
    value: "mysecretpassword"

Where Secrets SHOULD Be

Docker — BuildKit Secret Mounts

For build-time secrets (e.g., private npm tokens):

# ✅ Secret never persists in image layers
RUN --mount=type=secret,id=npm_token \
    NPM_TOKEN=$(cat /run/secrets/npm_token) \
    npm ci

Build command:

docker build --secret id=npm_token,src=.npm_token .

Docker Compose — External Secrets

# ✅ Secrets from files, not inline
services:
  app:
    secrets:
      - db_password
    environment:
      - DB_PASSWORD_FILE=/run/secrets/db_password

secrets:
  db_password:
    file: ./secrets/db_password.txt  # gitignored

Docker Swarm — Native Secrets

# Create secret
echo "mysecret" | docker secret create db_password -

# Reference in stack
services:
  app:
    secrets:
      - db_password
secrets:
  db_password:
    external: true

Kubernetes — Secrets + External Operators

Basic (acceptable for non-production):

apiVersion: v1
kind: Secret
metadata:
  name: app-secrets
type: Opaque
stringData:
  DB_PASSWORD: "value"  # Encrypt at rest in etcd

Mount as volume (preferred over env vars):

volumeMounts:
  - name: secrets
    mountPath: /etc/secrets
    readOnly: true
volumes:
  - name: secrets
    secret:
      secretName: app-secrets

Production — use an external operator:

  • ExternalSecrets Operator: Syncs from AWS/GCP/Azure/Vault
  • SealedSecrets: Encrypt secrets for safe git storage
  • Vault Secrets Operator: Direct HashiCorp Vault integration

CI/CD — Pipeline Secrets

# GitHub Actions — use encrypted secrets
env:
  DB_PASSWORD: ${{ secrets.DB_PASSWORD }}

# NEVER echo or log secrets
- run: |
    # ✅ Mask the secret
    echo "::add-mask::$DB_PASSWORD"

Secret Detection in CI

Add to every pipeline:

# Trivy secret scan
trivy fs --scanners secret --exit-code 1 .

# git-secrets (AWS-focused)
git secrets --scan

# Gitleaks
gitleaks detect --source . --verbose

.gitignore Essentials

Every project must exclude:

.env
.env.*
*.secret
*.pem
*.key
*.p12
*.pfx
secrets/
credentials/

Secrets Rotation Checklist

  • All secrets have an expiration policy
  • Rotation can happen without downtime
  • Old secrets are revoked after rotation
  • Rotation is automated where possible
  • Rotation events are logged and auditable

References

  • references/secrets-checklist.md — Full review checklist

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.