Secrets

From tinh2/skills-hub-registry · View interactive version

Secrets is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Audit codebases for leaked secrets and hardcoded credentials, generate .env templates, configure secrets management with AWS Secrets Manager, Vault, Doppler, or GCP Secret Manager, set up credential rotation, and integrate secrets into CI/CD pipelines via OIDC federation

How to use this skill

Skill file

You are in AUTONOMOUS MODE. Do NOT ask questions. Do NOT pause for confirmation.

Execute every phase below in sequence, making decisions based on what you find.

============================================================

PHASE 0 — INPUT

============================================================

$ARGUMENTS may contain:

============================================================

PHASE 1 — SECRET AUDIT

============================================================

Perform a comprehensive scan for secret exposure:

1. Hardcoded secrets in source code (exclude node_modules, vendor, .git):

2. Environment files:

3. Git history (last 50 commits):

4. Configuration files:

5. CI/CD configuration:

Severity classification:

============================================================

PHASE 2 — ENVIRONMENT TEMPLATE

============================================================

Generate .env.example from all detected environment variable references.

Scan for env var patterns:

Create .env.example with:

============================================================

PHASE 3 — SECRETS PROVIDER SETUP

============================================================

Based on detected infrastructure or $ARGUMENTS, set up the appropriate provider:

AWS Secrets Manager:

AWS Systems Manager Parameter Store:

GCP Secret Manager:

HashiCorp Vault:

Doppler:

For all providers, generate a unified secrets loading wrapper:

============================================================

PHASE 4 — SECRET ROTATION (if --rotate)

============================================================

Database credentials:

API keys:

TLS certificates:

============================================================

PHASE 5 — CI/CD INTEGRATION (if --ci)

============================================================

GitHub Actions:

Doppler:

General:

============================================================

PHASE 6 — REMEDIATION

============================================================

For each CRITICAL and HIGH finding from the audit:

  1. Hardcoded secrets: Replace with environment variable references
  2. Committed .env files: Add to .gitignore, remove from git tracking (warn about history)
  3. Docker compose passwords: Replace with variable references ${DB_PASSWORD}
  4. Missing .gitignore entries: Add .env*, *.pem, *.key, *.jks patterns

If secrets were found in git history:

============================================================

SELF-HEALING VALIDATION (max 2 iterations)

============================================================

After completing deployment/infrastructure changes, validate:

  1. Verify all generated files are syntactically valid (YAML, JSON, HCL, Dockerfile).
  2. Run validation commands if available (terraform validate, docker build --check, kubectl dry-run).
  3. Verify no secrets, credentials, or sensitive values are hardcoded.
  4. If validation fails, diagnose and fix the specific syntax or config error.
  5. Repeat up to 2 iterations.

IF STILL FAILING after 2 iterations:

============================================================

OUTPUT

============================================================

## Secrets Audit & Configuration

### Audit Results
| Severity | Finding | Location | Status |
|----------|---------|----------|--------|
| CRITICAL | {finding} | {file:line} | {fixed/needs-action} |
| HIGH | {finding} | {file} | {fixed/needs-action} |
| MEDIUM | {finding} | {file} | {fixed/needs-action} |

### Files Created/Modified
- .env.example — Environment variable template ({N} variables)
- .gitignore — Added secret file patterns
- {provider config files}
- {application secret loader}

### Secrets Inventory
| Secret | Provider | Rotation | CI/CD |
|--------|----------|----------|-------|
| DATABASE_URL | {provider} | 30 days | configured |
| JWT_SECRET | {provider} | 90 days | configured |

### Immediate Actions Required
{ordered list of manual actions needed, starting with credential rotation}

============================================================

NEXT STEPS

============================================================

  1. Rotate any credentials that were exposed in source or git history
  2. Set up the secrets provider account/project if not already done
  3. Migrate existing .env values to the secrets provider
  4. Update deployment scripts to pull secrets from provider at runtime
  5. Enable GitHub secret scanning and push protection on the repository
  6. Schedule quarterly secret rotation reviews

============================================================

SELF-EVOLUTION TELEMETRY

============================================================

After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:

Entry format:

### /secrets — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}

Only log if the memory directory exists. Skip silently if not found.

Keep entries concise — /evolve will parse these for skill improvement signals.

============================================================

DO NOT

============================================================

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.