skills/secrets-management/SKILL.md
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".
npx skillsauth add authegg/agent-skills secrets-managementInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Enforce secure secrets handling across Docker, Kubernetes, and CI/CD environments. Prevent credential leaks at every stage of the container lifecycle.
# ❌ 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
# ❌ Wrong
services:
app:
environment:
- DB_PASSWORD=mysecretpassword
- API_KEY=sk-abc123
# ❌ Wrong — plaintext in manifest
env:
- name: DB_PASSWORD
value: "mysecretpassword"
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 .
# ✅ 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
# Create secret
echo "mysecret" | docker secret create db_password -
# Reference in stack
services:
app:
secrets:
- db_password
secrets:
db_password:
external: true
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:
# 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"
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
Every project must exclude:
.env
.env.*
*.secret
*.pem
*.key
*.p12
*.pfx
secrets/
credentials/
references/secrets-checklist.md — Full review checklisttesting
Enforce Kubernetes pod and workload security best practices. Use when creating or editing Kubernetes manifests, Helm charts, or Kustomize overlays involving pods, deployments, statefulsets, daemonsets, jobs, or cronjobs. Covers Pod Security Standards (Restricted), SecurityContext hardening, RBAC least privilege, network policies, resource quotas, and admission control. Activates on keywords like "pod security", "K8s manifest", "deployment.yaml", "Helm chart", "securityContext", or "RBAC".
development
Enforce Docker container security best practices during development. Use when creating or editing Dockerfiles, docker-compose files, Kubernetes manifests, or CI/CD pipelines involving containers. Covers non-root users, slim base images, multi-stage builds, CVE scanning with Trivy, secrets management, capability dropping, network isolation, SBOM generation, and production readiness gates. Activates on keywords like "Dockerfile", "docker-compose", "container security", "image hardening", "Docker deploy", or "production readiness".
development
Generate and enforce security scanning stages in CI/CD pipelines. Use when creating or editing GitHub Actions workflows, GitLab CI, CircleCI, Jenkins, or any CI pipeline that builds Docker images or deploys containers. Covers Dockerfile linting with Hadolint, CVE scanning with Trivy, secret detection, SBOM generation, image signing, and deployment gates. Activates on keywords like "CI pipeline", "GitHub Actions", "security scanning", "Trivy", "Hadolint", "SBOM", or "deploy gate".
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.