scan-git-history-for-secrets
Use when a credential may have been committed, even if it was later deleted. Scans history with gitleaks and trufflehog, rotates first, and only then rewrites history.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- scan-git-history-for-secrets
- description
- Use when a credential may have been committed, even if it was later deleted. Scans history with gitleaks and trufflehog, rotates first, and only then rewrites history.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md354 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
Scan git history for secrets
Deleting a secret in a later commit does not remove it from history — anyone who cloned keeps it. Treat a committed secret as compromised the moment it lands, because the clock on rotation starts at that commit, not at the cleanup.
Procedure
-
Scan the working tree and the full history with two independent tools so their rule sets differ:
gitleaks detect --source . --redact --report-format json --report-path /tmp/gitleaks.json trufflehog git file://. --only-verified --json > /tmp/trufflehog.json -
Search history for a known string directly when you suspect a specific value:
git log -p -S 'AKIA' --all -- . | rg -n 'AKIA[0-9A-Z]{16}' git rev-list --all | xargs -n1 git grep -l 'PRIVATE KEY' 2>/dev/null | sort -u -
Triage each hit: tool, file, commit, value type, and whether the value is still live.
-
Rotate or revoke the credential before touching history. A rewrite that runs first leaves the old value valid and un-scanned clones intact:
aws iam delete-access-key --user-name "$USER" --access-key-id "$KEY" -
Rewrite history only after rotation, using
git filter-repo(preferred overfilter-branch):git filter-repo --path env/.env --invert-paths # or, for a single string in all files: git filter-repo --replace-text <(echo 'literal:OLD_SECRET==>REDACTED') -
Force-push the rewritten history and have every collaborator re-clone; a stale clone can re-push the secret.
-
Prevent recurrence with a pre-commit hook and a server-side check:
printf '#!/bin/sh\ngitleaks protect --staged --redact\n' > .git/hooks/pre-commit chmod +x .git/hooks/pre-commit
Pitfalls
git rmand a new commit leave the value ingit log -pforever.- Rotating the secret but leaving it in an old tag or a fork's
mainstill leaks it. - Secrets baked into CI logs, container layers, or an S3 backup survive a repo rewrite.
- A
.env.examplewith real values, or a test fixture with a live key, is a common miss. - High-entropy false positives (hashes, base64 fixtures) waste rotation effort — check
--only-verifiedoutput first. - Rewriting shared history without coordinating breaks every open branch; announce it first.
Verification
gitleaks detect --source . --redact --report-format json --report-path /tmp/g2.json; jq 'length' /tmp/g2.json
git log --all -p -S "OLD_SECRET" | wc -l
Pass: the gitleaks report is empty and the history search returns 0 lines. Report each secret found, the commit that introduced it, whether it was rotated, and the hooks now blocking recurrence.
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.