Works with the AI Agents you already use
Leaked Secret Response: Rotate, Purge, Prevent
Agents also make it worse: they `cat` the `.env` file, echo the value into chat, or force-push a rewritten history without asking anyone.
$12
Leaked Secret Response: Rotate, Purge, Prevent
Example session with this skill installed
Our CI just failed on a secret-scanning step for PR #212 on our public repo. I think I committed our AWS keys in config/dev.env two commits ago and pushed. Can you sort this out?
- Read your context and instructions
- Compiled the leaked secret response
Example session (illustrative).
1. Located (redacted). gitleaks git --redact -v reports 2 findings, both in config/dev.env, introduced in commit 3f9c2e1:
aws-access-tokenat line 4 (key ID shown asAKIAEXAMPLE…, value REDACTED)generic-api-keyat line 5 (the matching secret access key, REDACTED)
I have not opened or printed the file contents.
2. Exposure: L4. git branch -r --contains 3f9c2e1 shows origin/feature/billing, and PR #212 is on a public repo. Treat these keys as compromised already. Bots harvest public pushes within minutes.
3. Rotate now (you need to do this, or tell me to use the AWS CLI if it's configured):
- IAM console → Users →
ci-deployer→ Security credentials → Create access key. Put it in your secret manager or CI secrets, not in the repo. - On the old key
AKIAEXAMPLE…, choose Deactivate, then Delete. - Check usage with
aws iam get-access-key-last-used --access-key-id AKIAEXAMPLE…and look up that key ID in CloudTrail for the time it was exposed.
4. Code fix (on the PR branch, waiting for your OK to push): config/dev.env is untracked and added to .gitignore. I added config/dev.env.example with placeholder names, and the app reads AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY from the environment.
5. History purge needs your approval. Rewriting history means a force-push to a shared branch. Collaborators on feature/billing would have to reclone, and the PR may need re-opening. GitHub also keeps refs/pull/212/* and cached views until Support purges them. Forks and existing clones keep their copies whatever we do. If you approve, I'll run git filter-repo --sensitive-data-removal --invert-paths --path config/dev.env on a fresh clone, re-scan, and then git push --force --mirror origin.
6. Prevention staged: a gitleaks pre-commit hook pinned to a release tag, and .gitleaks.toml extending the default rules.
Status: NOT resolved until the old key is deleted in IAM and confirmed to fail.
Connects securely to your tools. The creator never sees your data.
About this skill
The problem. When an agent finds a leaked credential, its instinct is to delete the line, commit, and announce "fixed". That leaves the key live in git history, in every clone, in forks, in CI logs, and in scraper databases that crawl public GitHub events within minutes. Agents also make it worse: they cat the .env file, echo the value into chat, or force-push a rewritten history without asking anyone.
What the agent does with this skill.
- Locates leaks with redaction on (
gitleaks --redact) and refers to them by file, line, commit, and rule ID, never by value. - Classifies exposure from L0 (working tree only) to L4 (public repo, PR, CI log, published package) using
git branch -r --containsand tag checks, and tells you plainly when rotation is mandatory. - Rotates before rewriting, and explains why: rotation is the only step that makes the leaked value worthless. It names where to revoke AWS keys, GitHub tokens, Stripe keys, GCP service-account keys, Slack tokens, database passwords, and private keys, including zero-downtime options such as Stripe's rotate-with-expiry and MySQL dual passwords.
- Moves the value into environment variables or a secret manager.
- Purges history with
git filter-repo --sensitive-data-removal(or BFG) on a fresh clone. It does this only after you approve, and it spells out the coordination cost first. It covers the GitHub specifics: PR refs it cannot rewrite, contacting Support for cached views, and deleting Actions logs. - Verifies with gitleaks, then adds a pinned pre-commit hook,
.gitignoreentries, and a.gitleaks.tomlthat extends the default rules.
Who it's for. Solo developers and teams who let Claude Code, Cursor, Codex CLI, or similar agents work in real repositories, and who want a leak handled as an incident.
Requirements. git. gitleaks v8.25+ (the gitleaks git / gitleaks dir commands arrived in v8.19, global [[allowlists]] in v8.25). git-filter-repo 2.47+ for history purges (needed for --sensitive-data-removal). The provider's dashboard or CLI for rotation. It works without AgentHarness. If AgentHarness is installed, harness scan --staged is an optional pre-commit extra.
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.
Requires gitleaks and git-filter-repo to be installed locally. Cannot perform remote revocation without authenticated provider CLIs. Shared history rewrites require manual team coordination.
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 17 days ago
- Software
Gitgitleaksgit-filter-repo