Works with the AI Agents you already use
Leaked API Key Response: Rotate, Scrub Git History, Prevent
Committed an API key or password? Find every leak with gitleaks and TruffleHog, rotate in the right order, check for misuse, scrub history safely, add push protection.
$5
Leaked API Key Response: Rotate, Scrub Git History, Prevent
Example session with this skill installed
I pushed my .env to a public GitHub repo 2 hours ago. It has a Stripe secret key, an OpenAI key and the Postgres URL for production. I already deleted the file in a new commit. What now?
- Read your context and instructions
- Compiled the leaked api key
Secret leak response — VERDICT: ROTATE NOW
Exposure: public repo, first pushed today 14:07, no key revoked yet. Deleting the file does not remove it from history. Treat all three as compromised.
Do these now (in this order)
Stripe: Dashboard → Developers → API keys → roll the secret key. Put the new key in your host's env vars, redeploy, then let the old key expire immediately.
2. OpenAI: delete the key in the API keys page, create a new one, update env vars, redeploy.
3.
Postgres: create a new DB user with the same grants, switch DATABASE_URL, redeploy, then drop the old user. Restrict DB network access to your app's IPs if it is reachable from the internet.
Tell me when each is done and I will update the log.
Incident log
| # | Credential | Where found | Verified live? | Rotated | Old revoked | Misuse check |
|---|---|---|---|---|---|---|
| 1 | Stripe sk_l…9fQa | .env @ a41c9e2 | yes (TruffleHog) | pending | pending | check Payments, Payouts, Events since 14:07 |
| 2 | OpenAI sk-p…Lw2c | .env @ a41c9e2 | yes (TruffleHog) | pending | pending | Usage page since 14:07 |
| 3 | Postgres URL post…/app | .env @ a41c9e2 | unknown | pending | pending | connection logs from unknown IPs |
| 4 | Mapbox token pk.e…3kd | src/map.ts @ 77b02f1 (March) | public token | n/a | n/a | low risk: URL-restrict it |
Scans run
gitleaks git --redact -v . → 4 findings in 2 commits. trufflehog git file://. --results=verified,unknown → 2 verified, 1 unknown.
History cleanup (after rotation)
Recommended because the repo is public. Plan: git-filter-repo --sensitive-data-removal --invert-paths --path .env, force-push with your yes, then ask GitHub Support to purge cached views. Side effects: every commit hash after a41c9e2 changes; collaborators must re-clone.
Prevention added (ready to commit)
.gitignore (+ .env*, !.env.example), .env.example, .pre-commit-config.yaml with gitleaks, and turn on Settings → Code security → Push protection.
Connects securely to your tools. The creator never sees your data.
About this skill
A secret pushed to git is usually found by bots within minutes. Deleting the commit does not help: the key still works, and clones, forks, CI logs and cached pull requests keep a copy. What fixes it is revoking the key, and doing the rest in the right order.
This skill gives your coding agent an incident procedure and a reference file checked against GitHub's "Removing sensitive data" guide and the gitleaks, TruffleHog and git-filter-repo docs. It:
- Triages fast: what leaked, where, since when, public or private, and what the key can do. The provider's rotation step comes first, before any scanning
- Scans the full history with gitleaks (
gitmode, redacted) and TruffleHog (with verification), plus.envfiles, CI logs and Docker images - Groups findings by real credential and builds an incident log: rotated, old key revoked, consumers updated, misuse checked
- Gives rotation steps and the logs to check for AWS, GCP, Azure, GitHub, Stripe, LLM APIs, Slack, databases and private keys
- Optionally rewrites history with
git filter-repo --sensitive-data-removal, explains every side effect, force-pushes only with your yes, and tells you exactly what to send GitHub Support or GitLab cleanup - Adds prevention:
.gitignore,.env.example, a gitleaks pre-commit hook, a CI scan, and push protection - Returns a verdict: CONTAINED, ROTATE NOW or STILL EXPOSED
Who it is for: developers who just pushed a key, team leads handling a secret-scanning alert, and anyone cleaning up an old repo before making it public.
Safety: never prints full secrets (first and last 4 characters only), never revokes keys or touches provider accounts itself, and never force-pushes or rewrites history without an explicit yes.
Honesty note: a clean scan only means the tools found nothing with their rules. It says what it could not check, such as forks you cannot access or provider logs.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Security.
Cannot access private cloud logs or search engine caches. Scans are limited to tool regex patterns; custom or low-entropy secrets might be missed. Requires manual rotation by the user.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 29 days ago
- Software
GitgitleaksTruffleHog
- Optional
- git-filter-repo