Skip to content
Back to skills

Security

ASecurity

Handle API keys and credentials safely: storage levels, runtime injection, rotation, and the steps to take when a secret leaks. Use when code needs a credential, when adding a secret to config or CI, or after a secret was committed.

  • 24 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added October 14, 2026
ai-agentsrustgoshellrailskubernetesawsgitapisecurity

Works with

  • api

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned November 22, 2026

npx -y skills add andreibesleaga/GABBE --skill security --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Security?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Security
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/andreibesleaga-security-4497985f/badge)](https://www.skillsdirectory.com/skills/andreibesleaga-security-4497985f)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: secrets-management
description: "Handle API keys and credentials safely: storage levels, runtime injection, rotation, and the steps to take when a secret leaks. Use when code needs a credential, when adding a secret to config or CI, or after a secret was committed."
triggers: [secrets management, api key, rotate secret, leaked secret, vault, env file, credential leak]
tags: [security]
role: ops-security
context_cost: low
core: true
---
# secrets-management Skill

## Goal
This skill enforces the zero-trust handling of credentials.

## Where it fits
Phase and gate: S02 (where secrets live), S05 (never in code), S06 (secret scan), S11 (rotation and leak response). Evidence: secret-scan output, the rotation log in `docs/security/evidence/`, and an `AUDIT_LOG.md` row for each leak. Part of `security-baseline.skill.md`.

## 1. The Core Commandments
1.  **NEVER** commit secrets to Git. (Not even encrypted, if possible).
2.  **NEVER** log secrets to stdout/files.
3.  **LEAST PRIVILEGE**: An App's DB user should not be `postgres` (superuser).

## Steps
### Storage Patterns

### Level 1: Environment Variables (.env)
- **Dev**: `.env` file (gitignored).
- **Prod**: Injected by platform (Vercel/Heroku env vars).
- *Risk*: Shell history exposure, accidental printenv.

### Level 2: Secret Ops (SOPS / Encrypted Git)
- Secrets stored in git but encrypted with KMS/PGP.
- Decrypted only at build/deploy time.
- *Tool*: Mozilla SOPS, git-crypt.

### Level 3: Secret Manager (The Standard)
- AWS Secrets Manager, Google Secret Manager, HashiCorp Vault.
- App fetches secret at runtime via SDK or Sidecar.
- *Pros*: Rotation, Audit trails.

## 3. Secret Rotation
- **Static Secrets** (API Keys): Rotate on a schedule the project sets (90 days is a common default; write the chosen period in `project/SECURITY_BASELINE.md`) and at once after any leak.
- **Dynamic Secrets** (Db Creds): Vault creates a credential *per session* that expires in 1h.

## 4. Detection
- Scan history and tree: `gitleaks git -v` and `gitleaks dir -v .` (`gitleaks detect` is deprecated since v8.19.0). To stop a secret before the commit, install `pre-commit` and add the `gitleaks` hook from the gitleaks repository README (set `rev` to the current release tag).
- Platform control: on GitHub, push protection blocks pushes that contain secrets. A repository administrator or organisation owner turns it on; it needs GitHub Secret Protection (checked 2026-11-21).

## 4a. Leak response (a secret was committed, logged or sent)
Done when every line has a result in the incident note. The human runs or confirms each action marked (H).
1. Stop: do not add more commits that contain it. Do not print the value.
2. (H) Revoke or rotate the secret at the provider. Revoking comes first; cleaning history does not make the secret safe, because clones and forks keep it.
3. Find where it was used: the provider's access log for the key, from the commit date to now. List anything unexpected for the human.
4. Replace it in the current tree with a reference (environment variable or secret manager entry) and deploy the new value through the platform's secret store (H).
5. (H, optional) Rewrite history only if the human asks. Propose the exact command and the list of branches and clones affected, and warn that open pull requests and forks keep the old commits.
6. Record: an `AUDIT_LOG.md` row (date, what, who revoked, when) and, for tier 2 and 3, an entry in the incident log (`ops/incident-response.skill.md`).
7. Add the rule or path that was missed to the scanner configuration, and re-run the scan. Done when it is clean.

## 5. Kubernetes Secrets
- Default K8s Secrets are base64 encoded (NOT encrypted).
- **Requirement**: Enable Encryption-at-Rest for etcd.
- **Better**: Use "External Secrets Operator" to sync from AWS/Vault.

## Constraints
- No secret in code, config files in git, logs, chat or reports.
- Each secret has an owner, a store and a rotation period.

## Output Format
Secret-scan output, the rotation log, and the leak-response note when a leak happened, under `docs/security/evidence/`.

## Limits and safety
- Never print, log or commit a secret value. Reports show the variable name, file and line.
- Do not rotate, revoke or rewrite history yourself. Propose the exact commands and run them after the human confirms. Revoke first, clean up second.
- `.env` stays in `.gitignore`; check with `git check-ignore .env`.
- Do not create real secrets. Use placeholders in examples and tests.
- If your platform provides secret scanning or push protection, turn it on.

Files in this skill

  • access-control.skill.md3.2 KB
  • agent-sandboxing.skill.md8.3 KB
  • ai-ethics-compliance.skill.md3.4 KB
  • ai-red-teaming.skill.md7.9 KB
  • ai-safety-guardrails.skill.md6.1 KB
  • api-security.skill.md1.9 KB
  • backup-recovery.skill.md3.5 KB
  • compliance-review.skill.md7.6 KB
  • cryptography-standards.skill.md1.9 KB
  • dependency-security.skill.md3.4 KB
  • hazard-analysis.skill.md3.4 KB
  • legal-review.skill.md3.3 KB
  • log-analysis.skill.md3.9 KB
  • network-security.skill.md3.8 KB
  • privacy-audit.skill.md7.3 KB
  • privacy-data-protection.skill.md1.9 KB
  • prompt-injection-defense.skill.md6.8 KB
  • reliability-engineering.skill.md3.9 KB
  • safety-scan.skill.md3.4 KB
  • secrets-management.skill.md3.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.