leakkill 0.5.0__tar.gz → 0.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. {leakkill-0.5.0/src/leakkill.egg-info → leakkill-0.6.1}/PKG-INFO +109 -50
  2. {leakkill-0.5.0 → leakkill-0.6.1}/README.md +108 -49
  3. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill/__init__.py +1 -1
  4. leakkill-0.6.1/src/leakkill/agents.py +146 -0
  5. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill/cli.py +39 -11
  6. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill/gitleaks_rules.py +16 -16
  7. leakkill-0.6.1/src/leakkill/guard.py +281 -0
  8. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill/providers.py +2 -0
  9. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill/report.py +14 -8
  10. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill/scanner.py +66 -7
  11. {leakkill-0.5.0 → leakkill-0.6.1/src/leakkill.egg-info}/PKG-INFO +109 -50
  12. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill.egg-info/SOURCES.txt +3 -0
  13. leakkill-0.6.1/tests/test_agents.py +88 -0
  14. {leakkill-0.5.0 → leakkill-0.6.1}/tests/test_cli.py +11 -0
  15. {leakkill-0.5.0 → leakkill-0.6.1}/tests/test_coverage_gaps.py +1 -1
  16. leakkill-0.6.1/tests/test_guard_agents.py +162 -0
  17. {leakkill-0.5.0 → leakkill-0.6.1}/tests/test_import_gitleaks.py +11 -0
  18. {leakkill-0.5.0 → leakkill-0.6.1}/tests/test_providers.py +4 -2
  19. {leakkill-0.5.0 → leakkill-0.6.1}/tests/test_scanner.py +45 -0
  20. leakkill-0.5.0/src/leakkill/guard.py +0 -109
  21. {leakkill-0.5.0 → leakkill-0.6.1}/LICENSE +0 -0
  22. {leakkill-0.5.0 → leakkill-0.6.1}/THIRD_PARTY_NOTICES.md +0 -0
  23. {leakkill-0.5.0 → leakkill-0.6.1}/pyproject.toml +0 -0
  24. {leakkill-0.5.0 → leakkill-0.6.1}/setup.cfg +0 -0
  25. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill/__main__.py +0 -0
  26. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill/aws.py +0 -0
  27. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill/baseline.py +0 -0
  28. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill/sarif.py +0 -0
  29. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill.egg-info/dependency_links.txt +0 -0
  30. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill.egg-info/entry_points.txt +0 -0
  31. {leakkill-0.5.0 → leakkill-0.6.1}/src/leakkill.egg-info/top_level.txt +0 -0
  32. {leakkill-0.5.0 → leakkill-0.6.1}/tests/test_fuzz.py +0 -0
  33. {leakkill-0.5.0 → leakkill-0.6.1}/tests/test_guard.py +0 -0
  34. {leakkill-0.5.0 → leakkill-0.6.1}/tests/test_redos.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: leakkill
3
- Version: 0.5.0
3
+ Version: 0.6.1
4
4
  Summary: Find leaked secrets, check if they're live, revoke them in one command, and keep them out of AI coding agents
5
5
  Author-email: Ayush <andymylove24@gmail.com>
6
6
  License-Expression: MIT
@@ -20,13 +20,14 @@ Dynamic: license-file
20
20
 
21
21
  # leakkill
22
22
 
23
- [![PyPI](https://img.shields.io/pypi/v/leakkill)](https://pypi.org/project/leakkill/) [![CI](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml/badge.svg)](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/ayushanand27/leakkill/badge)](https://scorecard.dev/viewer/?uri=github.com/ayushanand27/leakkill)
23
+ [![PyPI](https://img.shields.io/pypi/v/leakkill)](https://pypi.org/project/leakkill/) [![CI](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml/badge.svg)](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/ayushanand27/leakkill/badge)](https://scorecard.dev/viewer/?uri=github.com/ayushanand27/leakkill) [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/15151/badge)](https://www.bestpractices.dev/projects/15151)
24
24
 
25
25
  **Leaked a key? Find it, see if it's live, and kill it in one command. Free, local, zero dependencies.**
26
26
 
27
- Free tools are great at *finding* secrets. What happens *after* a leak is usually left to paid
28
- platforms: is this key still working, whose account is it, how do I revoke it right now, and how do
29
- I clean it out of git history? leakkill does that part too, from your terminal, for free.
27
+ Most secret scanners stop at *finding* secrets. leakkill also answers what comes next: is this key still
28
+ working, whose account is it, how do I revoke it right now, and how do I clean it out of git history? It installs
29
+ with a plain `pip install` (no dependencies), runs locally, and can stop AI coding agents from reading or writing
30
+ secrets in the first place.
30
31
 
31
32
  ```console
32
33
  $ leakkill verify
@@ -51,6 +52,13 @@ pip install leakkill
51
52
  Python 3.9+, no dependencies. Latest development version:
52
53
  `pip install git+https://github.com/ayushanand27/leakkill`
53
54
 
55
+ Or with Docker, no Python needed:
56
+
57
+ ```sh
58
+ docker run --rm -v "$PWD:/scan" ghcr.io/ayushanand27/leakkill # scan this folder
59
+ docker run --rm -v "$PWD:/scan" ghcr.io/ayushanand27/leakkill --history # every commit
60
+ ```
61
+
54
62
  ## Commands
55
63
 
56
64
  | Command | What it does | Network? |
@@ -60,10 +68,11 @@ Python 3.9+, no dependencies. Latest development version:
60
68
  | `leakkill revoke` | Show what can be revoked. With `--yes`, revoke the live ones (`--only 1,3` to pick) | Only with `--yes` |
61
69
  | `leakkill report` | Write `leakkill-report.md`: every leak, its status and owner, and the cleanup steps in order | Same as `verify` (`--no-verify` to skip) |
62
70
  | `leakkill install-hook` | Git pre-commit hook that blocks commits containing secrets | Never |
63
- | `leakkill install-claude-hook` | Stop Claude Code reading `.env` and keys or writing secrets into code | Never |
71
+ | `leakkill install-agent-hooks` | Stop AI coding agents (Claude Code, Cursor, GitHub Copilot, OpenAI Codex) reading `.env` and keys, sending secrets in prompts, or writing secrets into code | Never |
64
72
 
65
73
  Every scan command also accepts `--staged` (pre-commit), `--history` (every commit on every branch,
66
- including secrets you already "deleted"), `--exclude-tests` and `--json`.
74
+ including secrets you already "deleted"), `--agents` (secrets your AI coding agents stored on this machine, see
75
+ below), `--exclude-tests` and `--json`.
67
76
 
68
77
  ## What it can verify and revoke
69
78
 
@@ -76,28 +85,33 @@ including secrets you already "deleted"), `--exclude-tests` and `--json`.
76
85
  | AWS access key and secret | ✅ IAM ARN and account (STS, needs no permissions) | ⚠️ deactivates the key if it has `iam:UpdateAccessKey`, otherwise console steps |
77
86
  | SendGrid (`SG.`) | ✅ scopes | ✅ the key deletes itself if it has API-key permissions |
78
87
  | Stripe (live and test keys), OpenAI, Anthropic, OpenRouter, Groq, Hugging Face, Replicate, DigitalOcean, npm, Telegram, Slack webhooks | ✅ (account or username where the API returns it) | ❌ the provider has no API for it, so you get the exact page or command |
79
- | Google API keys, Shopify, PyPI, Docker Hub, Twilio, Postman, Perplexity, Linear, Azure Storage, private keys, JWTs, credentials in URLs, generic high-entropy secrets | detected, not verified | step-by-step rotation guidance |
88
+ | Google API keys, Shopify, PyPI, Docker Hub, Twilio, Postman, Perplexity, Linear, Azure Storage, private keys, JWTs, credentials in URLs and Basic auth headers, generic high-entropy secrets | detected, not verified | step-by-step rotation guidance |
80
89
 
81
90
  ## How it compares
82
91
 
83
- | | leakkill | Gitleaks | TruffleHog OSS | GitGuardian | GitHub Secret Protection |
84
- |---|---|---|---|---|---|
85
- | Price | **Free (MIT)** | Free (MIT) | Free (AGPL) | Free for individuals, roughly $15–30/dev/month for teams | Free on public repos, $19/committer/month on private |
86
- | Runs fully local | ✅ | ✅ | ✅ | ❌ SaaS | ❌ GitHub only |
87
- | Detectors | 245 (31 leakkill + 214 imported from Gitleaks, credited) | 150+ | 800+ | 550+ | [provider list](https://docs.github.com/en/code-security/secret-scanning/introduction/supported-secret-scanning-patterns) |
88
- | Checks if a key is live | ✅ 17 providers | ❌ | ✅ (its main strength) | ✅ | ✅ some |
89
- | Revokes from the CLI | ✅ 6 providers | ❌ | ❌ (Enterprise) | partial | ❌ |
90
- | Incident report and history-purge steps | ✅ Markdown file | ❌ | ❌ | ✅ dashboard and playbooks | ❌ |
91
- | Guards AI coding agents | ✅ Claude Code hooks | ❌ | ❌ | ❌ | ❌ |
92
- | SARIF / baselines | ✅ / ✅ hashes only | ✅ / ✅ (stores secrets) | ✅ / ❌ | ✅ / ✅ | built in |
93
- | Dependencies | none | Go binary | Go binary | CLI + account | GitHub |
94
-
95
- Detector and pricing figures come from public sources in October 2026. Use what fits your needs:
96
- if breadth of detection matters most, run Gitleaks or TruffleHog alongside leakkill.
92
+ | | leakkill | Kingfisher | Betterleaks | Gitleaks | TruffleHog OSS | GitGuardian |
93
+ |---|---|---|---|---|---|---|
94
+ | License / price | MIT, free | Apache 2.0, free | MIT, free | MIT, free | AGPL, free | free for individuals, paid for teams |
95
+ | Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
96
+ | Install | `pip` (zero dependencies) or Docker | Rust binary | Go binary | Go binary | Go binary | CLI + account |
97
+ | Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
98
+ | Checks if a key is live | ✅ 17 providers | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
99
+ | Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
100
+ | Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
101
+ | Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
102
+ | Scans Slack / Jira / S3 / Docker | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ |
103
+ | SARIF / baselines | ✅ / ✅ hashes only | ✅ / ✅ | ✅ / ✅ | ✅ / ✅ (stores secrets) | ✅ / ❌ | ✅ / ✅ |
104
+
105
+ **Where each is strongest** (accuracy below): Betterleaks finds the most real credentials; Kingfisher has the
106
+ fewest false alarms and the broadest platform coverage with validation and revocation; TruffleHog verifies the
107
+ most providers. leakkill's niche is a dependency-free `pip install` that goes from finding to revoked key to
108
+ cleanup plan, guards AI coding agents, and is the best of these at passwords embedded in URLs and Basic auth headers.
109
+
110
+ Figures from each project's documentation, October 2026. Use what fits: running two scanners is common.
97
111
 
98
112
  ### Detection rules
99
113
 
100
- leakkill's own 31 rules cover the providers it can verify and revoke. On top of those, it includes
114
+ leakkill's own 32 rules cover the providers it can verify and revoke. On top of those, it includes
101
115
  **214 provider rules from [Gitleaks](https://github.com/gitleaks/gitleaks)** (MIT), translated to Python by
102
116
  [`tools/import_gitleaks.py`](tools/import_gitleaks.py) from a pinned, checksum-verified release, together with
103
117
  Gitleaks' entropy thresholds and allowlists. Thank you to the Gitleaks maintainers. See
@@ -136,30 +150,38 @@ SendGrid, Telegram) are covered by tests using simulated API responses.
136
150
 
137
151
  ### Accuracy (independent dataset)
138
152
 
139
- On [Samsung CredData](https://github.com/Samsung/CredData), 67,896 lines labeled by people, scored by the
140
- same script for every tool ([details and how to reproduce](benchmarks/README.md)):
153
+ On [Samsung CredData](https://github.com/Samsung/CredData), 67,896 lines labeled by people, every tool scored
154
+ by the same script ([details and how to reproduce](benchmarks/README.md)):
141
155
 
142
- | | precision | recall | precision / recall without OpenSSL test vectors |
143
- |---|---|---|---|
144
- | **leakkill** | 0.834 | 0.251 | 0.893 / 0.217 |
145
- | Gitleaks 8.28 | 0.860 | 0.453 | 0.910 / 0.218 |
146
- | TruffleHog 3.97 (detection only) | 0.579 | 0.024 | 0.486 / 0.026 |
156
+ | | precision | recall | F1 | without OpenSSL test vectors (P / R / F1) | passwords in URLs | HTTP Basic auth |
157
+ |---|---|---|---|---|---|---|
158
+ | **leakkill 0.6** | 0.825 | 0.510 | **0.630** | 0.922 / 0.300 / 0.453 | **182/209** | **601/601** |
159
+ | Betterleaks 1.9 | 0.712 | **0.562** | 0.628 | 0.585 / **0.379** / **0.460** | 96/209 | 10/601 |
160
+ | Gitleaks 8.28 | 0.860 | 0.453 | 0.594 | 0.910 / 0.218 / 0.351 | 0/209 | 0/601 |
161
+ | Kingfisher 2.9 (no validation) | **0.961** | 0.104 | 0.187 | **0.925** / 0.079 / 0.145 | 20/209 | 5/601 |
162
+ | TruffleHog 3.97 (no verification) | 0.579 | 0.024 | 0.045 | 0.486 / 0.026 / 0.049 | 59/209 | 0/601 |
147
163
 
148
- On ordinary code leakkill matches Gitleaks; it finds 182/209 passwords in URLs (Gitleaks 0). Gitleaks' higher
149
- recall on the full set comes mostly from OpenSSL crypto test vectors that leakkill deliberately doesn't flag.
150
- False alarms on clean repositories (requests, flask, django, express): 1 / 2 / 3 / 0.
164
+ Compare on the "without OpenSSL test vectors" column: those are public crypto test data, not leaks. There,
165
+ leakkill and Betterleaks are level on F1. Betterleaks finds more credentials (recall 0.379 vs 0.300); leakkill
166
+ raises far fewer false alarms (precision 0.922 vs 0.585). leakkill is far ahead on passwords in URLs and Basic
167
+ auth headers, because it decodes and checks them. The generic rules were tuned on this dataset, which flatters
168
+ leakkill somewhat; false alarms on four clean repositories (requests, flask, django, express) stayed at
169
+ 1 / 2 / 3 / 0.
151
170
 
152
171
  ### How it's tested
153
172
 
154
- - 108 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 92%).
173
+ - 137 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
155
174
  - Property-based fuzz tests: the scanner never crashes on random input, never prints a raw secret, finds a
156
175
  planted token in any surrounding text, and gives the same answer scanning a whole file or line by line.
157
176
  (Fuzzing found two real bugs before release: a guard crash and a slow-input case, both fixed.)
158
- - Every one of the 245 rules is checked in CI against hostile input built from its own keywords, because
177
+ - Coverage-guided fuzzing with Atheris via ClusterFuzzLite on every pull request and weekly, of the scanner,
178
+ the transcript reader and the AI agent guard. Its first run found a real bug in under a minute: the
179
+ guard could quote a secret hidden in a file name back to the agent. Fixed, with a regression test.
180
+ - Every one of the 246 rules is checked in CI against hostile input built from its own keywords, because
159
181
  Python's regex engine, unlike Go's, can be made to backtrack for minutes. The sweep found and fixed 4
160
182
  such rules among those imported from Gitleaks.
161
183
  - Live tests against real APIs with real throwaway keys (above), and of the Claude Code guard in the real CLI.
162
- - SonarCloud, OpenSSF Scorecard, pinned and hash-locked CI tooling, signed PyPI provenance.
184
+ - OpenSSF Best Practices (passing), SonarCloud, OpenSSF Scorecard, pinned and hash-locked CI tooling, signed PyPI provenance, Sigstore-signed GitHub releases (see SECURITY.md).
163
185
 
164
186
  ## Safety model
165
187
 
@@ -170,7 +192,7 @@ False alarms on clean repositories (requests, flask, django, express): 1 / 2 / 3
170
192
  `GetCallerIdentity` and so on.
171
193
  - `revoke` is a dry run unless you pass `--yes`, and only touches keys that verified as live.
172
194
  - Raw secrets are never printed or written to the report. The only exception is the opt-in
173
- `report --replacements FILE` (needed by `git filter-repo`), which is created with permissions 600.
195
+ `report --replacements FILE` (needed by `git filter-repo`), which is created with permissions 600 and never overwrites an existing file.
174
196
 
175
197
  ## Cleaning git history
176
198
 
@@ -183,20 +205,51 @@ rm .leakkill-replacements.txt
183
205
  git push --force --all && git push --force --tags # every collaborator must re-clone
184
206
  ```
185
207
 
186
- ## AI coding agent guard (Claude Code)
208
+ ## AI coding agent guard
209
+
210
+ ```sh
211
+ leakkill install-agent-hooks # all four, in this project
212
+ leakkill install-agent-hooks cursor codex # just these
213
+ leakkill install-agent-hooks --global # for your user account, every project
214
+ ```
215
+
216
+ | Agent | Config written | Secret in a prompt | Reading `.env` / keys (file or shell) | Writing a key into code |
217
+ |---|---|---|---|---|
218
+ | Claude Code | `.claude/settings.json` | blocked | blocked | blocked |
219
+ | Cursor | `.cursor/hooks.json` | blocked | blocked, and any file whose content holds a key | blocked |
220
+ | GitHub Copilot CLI | `.github/hooks/leakkill.json` | warned only (Copilot ignores prompt-hook decisions) | blocked | blocked |
221
+ | OpenAI Codex | `.codex/hooks.json` | blocked | blocked | blocked, per file of each `apply_patch` |
222
+
223
+ Sensitive files are `.env` (but not `.env.example`), `*.pem`, `*.key`, `id_rsa`, `.npmrc`, `.pypirc` and
224
+ similar; a shell command that names one (`cat`, `grep`, `base64`, `python -c`, `cp` …) is blocked too.
225
+ Writing keys **into** `.env` is allowed, since that is where they belong. If the guard itself fails, it
226
+ blocks rather than lets a secret through. Codex only runs hooks you trust: after installing, type
227
+ `/hooks` in Codex and trust the leakkill hook.
228
+
229
+ Tested live with the Claude Code CLI: prompts with keys, `Read .env`, `cat .env`, `grep . .env` and
230
+ writing an AWS key into `app.py` were all blocked. Cursor, Copilot and Codex are tested against the hook
231
+ formats in their documentation, through the same command they run; if you see one misbehave, please open
232
+ an issue. The check is pattern-based: a command that builds the file name at runtime can get past it.
233
+ Pair it with OS-level permissions for hard guarantees.
234
+
235
+ ## Secrets your AI agents already stored
236
+
237
+ ```sh
238
+ leakkill scan --agents # what's there
239
+ leakkill verify --agents # ...and which of those keys still work
240
+ ```
187
241
 
188
- `leakkill install-claude-hook` adds hooks to `.claude/settings.json` that block:
242
+ AI coding agents keep plain-text session transcripts and prompt histories, and MCP server configs often hold
243
+ API keys. A key you pasted into a chat, or a `.env` the agent read, stays on disk there, and was sent to the
244
+ model provider. `--agents` scans, on your machine only:
189
245
 
190
- - prompts that contain secrets (before they reach the model)
191
- - reading `.env`, `*.pem`, `id_rsa`, `.npmrc` and similar, whether through the Read tool or any
192
- shell command that names such a file (`cat`, `grep`, `base64`, `python -c`, `cp` …).
193
- `.env.example` is allowed.
194
- - writing hard-coded keys into code (writing them into `.env` is allowed)
246
+ - Claude Code (`~/.claude.json`, `~/.claude/` including session transcripts), Codex (`~/.codex/`), GitHub
247
+ Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor, Windsurf, Claude Desktop and VS Code MCP configs
248
+ - this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
195
249
 
196
- This was tested live with the Claude Code CLI: prompts with keys, `Read .env`, `cat .env`,
197
- `grep . .env` and writing an AWS key into `app.py` were all blocked. The check is pattern-based: a
198
- command that builds the file name at runtime can get past it. Pair it with OS-level permissions for
199
- hard guarantees.
250
+ Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
251
+ login files (`~/.codex/auth.json`, `~/.claude/.credentials.json`, Gemini's OAuth file) are skipped, since that is
252
+ where their tokens belong. Cursor's chat history is stored in a database and is not scanned yet.
200
253
 
201
254
  ## Use in CI (GitHub Action)
202
255
 
@@ -269,7 +322,7 @@ baseline doesn't make it safe: revoke real keys first.
269
322
  # .pre-commit-config.yaml
270
323
  repos:
271
324
  - repo: https://github.com/ayushanand27/leakkill
272
- rev: v0.5.0
325
+ rev: v0.6.1
273
326
  hooks:
274
327
  - id: leakkill
275
328
  ```
@@ -285,7 +338,13 @@ Or without the framework: `leakkill install-hook`.
285
338
 
286
339
  ## Known limitations
287
340
 
288
- - Detection breadth is close to Gitleaks (whose rules it includes) but below TruffleHog (800+ detectors).
341
+ - Finds fewer real credentials than Betterleaks (recall 0.30 vs 0.38 on real code in CredData, with far fewer
342
+ false alarms), and has fewer rules than Kingfisher or TruffleHog.
343
+ - Scans files, git history and local AI agent files: not Slack, Jira, Confluence, S3 or Docker images.
344
+ - The agent guard is pattern-based: a command that builds a file name at runtime can get past it. The Cursor,
345
+ Copilot and Codex guards are tested against their documented hook formats; only Claude Code was tested in the
346
+ real app. Copilot ignores prompt hooks, so a key typed into a Copilot prompt is warned about, not blocked.
347
+ - `--agents` doesn't read Cursor's chat history (a database), only its MCP config.
289
348
  - On very large repositories (tens of MB) scanning is about 2x slower than Gitleaks.
290
349
  - Verification behind a proxy that injects its own credentials (some corporate and sandbox proxies
291
350
  do) can report the proxy's identity. Run `verify` from a normal network.
@@ -1,12 +1,13 @@
1
1
  # leakkill
2
2
 
3
- [![PyPI](https://img.shields.io/pypi/v/leakkill)](https://pypi.org/project/leakkill/) [![CI](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml/badge.svg)](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/ayushanand27/leakkill/badge)](https://scorecard.dev/viewer/?uri=github.com/ayushanand27/leakkill)
3
+ [![PyPI](https://img.shields.io/pypi/v/leakkill)](https://pypi.org/project/leakkill/) [![CI](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml/badge.svg)](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/ayushanand27/leakkill/badge)](https://scorecard.dev/viewer/?uri=github.com/ayushanand27/leakkill) [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/15151/badge)](https://www.bestpractices.dev/projects/15151)
4
4
 
5
5
  **Leaked a key? Find it, see if it's live, and kill it in one command. Free, local, zero dependencies.**
6
6
 
7
- Free tools are great at *finding* secrets. What happens *after* a leak is usually left to paid
8
- platforms: is this key still working, whose account is it, how do I revoke it right now, and how do
9
- I clean it out of git history? leakkill does that part too, from your terminal, for free.
7
+ Most secret scanners stop at *finding* secrets. leakkill also answers what comes next: is this key still
8
+ working, whose account is it, how do I revoke it right now, and how do I clean it out of git history? It installs
9
+ with a plain `pip install` (no dependencies), runs locally, and can stop AI coding agents from reading or writing
10
+ secrets in the first place.
10
11
 
11
12
  ```console
12
13
  $ leakkill verify
@@ -31,6 +32,13 @@ pip install leakkill
31
32
  Python 3.9+, no dependencies. Latest development version:
32
33
  `pip install git+https://github.com/ayushanand27/leakkill`
33
34
 
35
+ Or with Docker, no Python needed:
36
+
37
+ ```sh
38
+ docker run --rm -v "$PWD:/scan" ghcr.io/ayushanand27/leakkill # scan this folder
39
+ docker run --rm -v "$PWD:/scan" ghcr.io/ayushanand27/leakkill --history # every commit
40
+ ```
41
+
34
42
  ## Commands
35
43
 
36
44
  | Command | What it does | Network? |
@@ -40,10 +48,11 @@ Python 3.9+, no dependencies. Latest development version:
40
48
  | `leakkill revoke` | Show what can be revoked. With `--yes`, revoke the live ones (`--only 1,3` to pick) | Only with `--yes` |
41
49
  | `leakkill report` | Write `leakkill-report.md`: every leak, its status and owner, and the cleanup steps in order | Same as `verify` (`--no-verify` to skip) |
42
50
  | `leakkill install-hook` | Git pre-commit hook that blocks commits containing secrets | Never |
43
- | `leakkill install-claude-hook` | Stop Claude Code reading `.env` and keys or writing secrets into code | Never |
51
+ | `leakkill install-agent-hooks` | Stop AI coding agents (Claude Code, Cursor, GitHub Copilot, OpenAI Codex) reading `.env` and keys, sending secrets in prompts, or writing secrets into code | Never |
44
52
 
45
53
  Every scan command also accepts `--staged` (pre-commit), `--history` (every commit on every branch,
46
- including secrets you already "deleted"), `--exclude-tests` and `--json`.
54
+ including secrets you already "deleted"), `--agents` (secrets your AI coding agents stored on this machine, see
55
+ below), `--exclude-tests` and `--json`.
47
56
 
48
57
  ## What it can verify and revoke
49
58
 
@@ -56,28 +65,33 @@ including secrets you already "deleted"), `--exclude-tests` and `--json`.
56
65
  | AWS access key and secret | ✅ IAM ARN and account (STS, needs no permissions) | ⚠️ deactivates the key if it has `iam:UpdateAccessKey`, otherwise console steps |
57
66
  | SendGrid (`SG.`) | ✅ scopes | ✅ the key deletes itself if it has API-key permissions |
58
67
  | Stripe (live and test keys), OpenAI, Anthropic, OpenRouter, Groq, Hugging Face, Replicate, DigitalOcean, npm, Telegram, Slack webhooks | ✅ (account or username where the API returns it) | ❌ the provider has no API for it, so you get the exact page or command |
59
- | Google API keys, Shopify, PyPI, Docker Hub, Twilio, Postman, Perplexity, Linear, Azure Storage, private keys, JWTs, credentials in URLs, generic high-entropy secrets | detected, not verified | step-by-step rotation guidance |
68
+ | Google API keys, Shopify, PyPI, Docker Hub, Twilio, Postman, Perplexity, Linear, Azure Storage, private keys, JWTs, credentials in URLs and Basic auth headers, generic high-entropy secrets | detected, not verified | step-by-step rotation guidance |
60
69
 
61
70
  ## How it compares
62
71
 
63
- | | leakkill | Gitleaks | TruffleHog OSS | GitGuardian | GitHub Secret Protection |
64
- |---|---|---|---|---|---|
65
- | Price | **Free (MIT)** | Free (MIT) | Free (AGPL) | Free for individuals, roughly $15–30/dev/month for teams | Free on public repos, $19/committer/month on private |
66
- | Runs fully local | ✅ | ✅ | ✅ | ❌ SaaS | ❌ GitHub only |
67
- | Detectors | 245 (31 leakkill + 214 imported from Gitleaks, credited) | 150+ | 800+ | 550+ | [provider list](https://docs.github.com/en/code-security/secret-scanning/introduction/supported-secret-scanning-patterns) |
68
- | Checks if a key is live | ✅ 17 providers | ❌ | ✅ (its main strength) | ✅ | ✅ some |
69
- | Revokes from the CLI | ✅ 6 providers | ❌ | ❌ (Enterprise) | partial | ❌ |
70
- | Incident report and history-purge steps | ✅ Markdown file | ❌ | ❌ | ✅ dashboard and playbooks | ❌ |
71
- | Guards AI coding agents | ✅ Claude Code hooks | ❌ | ❌ | ❌ | ❌ |
72
- | SARIF / baselines | ✅ / ✅ hashes only | ✅ / ✅ (stores secrets) | ✅ / ❌ | ✅ / ✅ | built in |
73
- | Dependencies | none | Go binary | Go binary | CLI + account | GitHub |
74
-
75
- Detector and pricing figures come from public sources in October 2026. Use what fits your needs:
76
- if breadth of detection matters most, run Gitleaks or TruffleHog alongside leakkill.
72
+ | | leakkill | Kingfisher | Betterleaks | Gitleaks | TruffleHog OSS | GitGuardian |
73
+ |---|---|---|---|---|---|---|
74
+ | License / price | MIT, free | Apache 2.0, free | MIT, free | MIT, free | AGPL, free | free for individuals, paid for teams |
75
+ | Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
76
+ | Install | `pip` (zero dependencies) or Docker | Rust binary | Go binary | Go binary | Go binary | CLI + account |
77
+ | Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
78
+ | Checks if a key is live | ✅ 17 providers | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
79
+ | Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
80
+ | Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
81
+ | Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
82
+ | Scans Slack / Jira / S3 / Docker | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ |
83
+ | SARIF / baselines | ✅ / ✅ hashes only | ✅ / ✅ | ✅ / ✅ | ✅ / ✅ (stores secrets) | ✅ / ❌ | ✅ / ✅ |
84
+
85
+ **Where each is strongest** (accuracy below): Betterleaks finds the most real credentials; Kingfisher has the
86
+ fewest false alarms and the broadest platform coverage with validation and revocation; TruffleHog verifies the
87
+ most providers. leakkill's niche is a dependency-free `pip install` that goes from finding to revoked key to
88
+ cleanup plan, guards AI coding agents, and is the best of these at passwords embedded in URLs and Basic auth headers.
89
+
90
+ Figures from each project's documentation, October 2026. Use what fits: running two scanners is common.
77
91
 
78
92
  ### Detection rules
79
93
 
80
- leakkill's own 31 rules cover the providers it can verify and revoke. On top of those, it includes
94
+ leakkill's own 32 rules cover the providers it can verify and revoke. On top of those, it includes
81
95
  **214 provider rules from [Gitleaks](https://github.com/gitleaks/gitleaks)** (MIT), translated to Python by
82
96
  [`tools/import_gitleaks.py`](tools/import_gitleaks.py) from a pinned, checksum-verified release, together with
83
97
  Gitleaks' entropy thresholds and allowlists. Thank you to the Gitleaks maintainers. See
@@ -116,30 +130,38 @@ SendGrid, Telegram) are covered by tests using simulated API responses.
116
130
 
117
131
  ### Accuracy (independent dataset)
118
132
 
119
- On [Samsung CredData](https://github.com/Samsung/CredData), 67,896 lines labeled by people, scored by the
120
- same script for every tool ([details and how to reproduce](benchmarks/README.md)):
133
+ On [Samsung CredData](https://github.com/Samsung/CredData), 67,896 lines labeled by people, every tool scored
134
+ by the same script ([details and how to reproduce](benchmarks/README.md)):
121
135
 
122
- | | precision | recall | precision / recall without OpenSSL test vectors |
123
- |---|---|---|---|
124
- | **leakkill** | 0.834 | 0.251 | 0.893 / 0.217 |
125
- | Gitleaks 8.28 | 0.860 | 0.453 | 0.910 / 0.218 |
126
- | TruffleHog 3.97 (detection only) | 0.579 | 0.024 | 0.486 / 0.026 |
136
+ | | precision | recall | F1 | without OpenSSL test vectors (P / R / F1) | passwords in URLs | HTTP Basic auth |
137
+ |---|---|---|---|---|---|---|
138
+ | **leakkill 0.6** | 0.825 | 0.510 | **0.630** | 0.922 / 0.300 / 0.453 | **182/209** | **601/601** |
139
+ | Betterleaks 1.9 | 0.712 | **0.562** | 0.628 | 0.585 / **0.379** / **0.460** | 96/209 | 10/601 |
140
+ | Gitleaks 8.28 | 0.860 | 0.453 | 0.594 | 0.910 / 0.218 / 0.351 | 0/209 | 0/601 |
141
+ | Kingfisher 2.9 (no validation) | **0.961** | 0.104 | 0.187 | **0.925** / 0.079 / 0.145 | 20/209 | 5/601 |
142
+ | TruffleHog 3.97 (no verification) | 0.579 | 0.024 | 0.045 | 0.486 / 0.026 / 0.049 | 59/209 | 0/601 |
127
143
 
128
- On ordinary code leakkill matches Gitleaks; it finds 182/209 passwords in URLs (Gitleaks 0). Gitleaks' higher
129
- recall on the full set comes mostly from OpenSSL crypto test vectors that leakkill deliberately doesn't flag.
130
- False alarms on clean repositories (requests, flask, django, express): 1 / 2 / 3 / 0.
144
+ Compare on the "without OpenSSL test vectors" column: those are public crypto test data, not leaks. There,
145
+ leakkill and Betterleaks are level on F1. Betterleaks finds more credentials (recall 0.379 vs 0.300); leakkill
146
+ raises far fewer false alarms (precision 0.922 vs 0.585). leakkill is far ahead on passwords in URLs and Basic
147
+ auth headers, because it decodes and checks them. The generic rules were tuned on this dataset, which flatters
148
+ leakkill somewhat; false alarms on four clean repositories (requests, flask, django, express) stayed at
149
+ 1 / 2 / 3 / 0.
131
150
 
132
151
  ### How it's tested
133
152
 
134
- - 108 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 92%).
153
+ - 137 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
135
154
  - Property-based fuzz tests: the scanner never crashes on random input, never prints a raw secret, finds a
136
155
  planted token in any surrounding text, and gives the same answer scanning a whole file or line by line.
137
156
  (Fuzzing found two real bugs before release: a guard crash and a slow-input case, both fixed.)
138
- - Every one of the 245 rules is checked in CI against hostile input built from its own keywords, because
157
+ - Coverage-guided fuzzing with Atheris via ClusterFuzzLite on every pull request and weekly, of the scanner,
158
+ the transcript reader and the AI agent guard. Its first run found a real bug in under a minute: the
159
+ guard could quote a secret hidden in a file name back to the agent. Fixed, with a regression test.
160
+ - Every one of the 246 rules is checked in CI against hostile input built from its own keywords, because
139
161
  Python's regex engine, unlike Go's, can be made to backtrack for minutes. The sweep found and fixed 4
140
162
  such rules among those imported from Gitleaks.
141
163
  - Live tests against real APIs with real throwaway keys (above), and of the Claude Code guard in the real CLI.
142
- - SonarCloud, OpenSSF Scorecard, pinned and hash-locked CI tooling, signed PyPI provenance.
164
+ - OpenSSF Best Practices (passing), SonarCloud, OpenSSF Scorecard, pinned and hash-locked CI tooling, signed PyPI provenance, Sigstore-signed GitHub releases (see SECURITY.md).
143
165
 
144
166
  ## Safety model
145
167
 
@@ -150,7 +172,7 @@ False alarms on clean repositories (requests, flask, django, express): 1 / 2 / 3
150
172
  `GetCallerIdentity` and so on.
151
173
  - `revoke` is a dry run unless you pass `--yes`, and only touches keys that verified as live.
152
174
  - Raw secrets are never printed or written to the report. The only exception is the opt-in
153
- `report --replacements FILE` (needed by `git filter-repo`), which is created with permissions 600.
175
+ `report --replacements FILE` (needed by `git filter-repo`), which is created with permissions 600 and never overwrites an existing file.
154
176
 
155
177
  ## Cleaning git history
156
178
 
@@ -163,20 +185,51 @@ rm .leakkill-replacements.txt
163
185
  git push --force --all && git push --force --tags # every collaborator must re-clone
164
186
  ```
165
187
 
166
- ## AI coding agent guard (Claude Code)
188
+ ## AI coding agent guard
189
+
190
+ ```sh
191
+ leakkill install-agent-hooks # all four, in this project
192
+ leakkill install-agent-hooks cursor codex # just these
193
+ leakkill install-agent-hooks --global # for your user account, every project
194
+ ```
195
+
196
+ | Agent | Config written | Secret in a prompt | Reading `.env` / keys (file or shell) | Writing a key into code |
197
+ |---|---|---|---|---|
198
+ | Claude Code | `.claude/settings.json` | blocked | blocked | blocked |
199
+ | Cursor | `.cursor/hooks.json` | blocked | blocked, and any file whose content holds a key | blocked |
200
+ | GitHub Copilot CLI | `.github/hooks/leakkill.json` | warned only (Copilot ignores prompt-hook decisions) | blocked | blocked |
201
+ | OpenAI Codex | `.codex/hooks.json` | blocked | blocked | blocked, per file of each `apply_patch` |
202
+
203
+ Sensitive files are `.env` (but not `.env.example`), `*.pem`, `*.key`, `id_rsa`, `.npmrc`, `.pypirc` and
204
+ similar; a shell command that names one (`cat`, `grep`, `base64`, `python -c`, `cp` …) is blocked too.
205
+ Writing keys **into** `.env` is allowed, since that is where they belong. If the guard itself fails, it
206
+ blocks rather than lets a secret through. Codex only runs hooks you trust: after installing, type
207
+ `/hooks` in Codex and trust the leakkill hook.
208
+
209
+ Tested live with the Claude Code CLI: prompts with keys, `Read .env`, `cat .env`, `grep . .env` and
210
+ writing an AWS key into `app.py` were all blocked. Cursor, Copilot and Codex are tested against the hook
211
+ formats in their documentation, through the same command they run; if you see one misbehave, please open
212
+ an issue. The check is pattern-based: a command that builds the file name at runtime can get past it.
213
+ Pair it with OS-level permissions for hard guarantees.
214
+
215
+ ## Secrets your AI agents already stored
216
+
217
+ ```sh
218
+ leakkill scan --agents # what's there
219
+ leakkill verify --agents # ...and which of those keys still work
220
+ ```
167
221
 
168
- `leakkill install-claude-hook` adds hooks to `.claude/settings.json` that block:
222
+ AI coding agents keep plain-text session transcripts and prompt histories, and MCP server configs often hold
223
+ API keys. A key you pasted into a chat, or a `.env` the agent read, stays on disk there, and was sent to the
224
+ model provider. `--agents` scans, on your machine only:
169
225
 
170
- - prompts that contain secrets (before they reach the model)
171
- - reading `.env`, `*.pem`, `id_rsa`, `.npmrc` and similar, whether through the Read tool or any
172
- shell command that names such a file (`cat`, `grep`, `base64`, `python -c`, `cp` …).
173
- `.env.example` is allowed.
174
- - writing hard-coded keys into code (writing them into `.env` is allowed)
226
+ - Claude Code (`~/.claude.json`, `~/.claude/` including session transcripts), Codex (`~/.codex/`), GitHub
227
+ Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor, Windsurf, Claude Desktop and VS Code MCP configs
228
+ - this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
175
229
 
176
- This was tested live with the Claude Code CLI: prompts with keys, `Read .env`, `cat .env`,
177
- `grep . .env` and writing an AWS key into `app.py` were all blocked. The check is pattern-based: a
178
- command that builds the file name at runtime can get past it. Pair it with OS-level permissions for
179
- hard guarantees.
230
+ Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
231
+ login files (`~/.codex/auth.json`, `~/.claude/.credentials.json`, Gemini's OAuth file) are skipped, since that is
232
+ where their tokens belong. Cursor's chat history is stored in a database and is not scanned yet.
180
233
 
181
234
  ## Use in CI (GitHub Action)
182
235
 
@@ -249,7 +302,7 @@ baseline doesn't make it safe: revoke real keys first.
249
302
  # .pre-commit-config.yaml
250
303
  repos:
251
304
  - repo: https://github.com/ayushanand27/leakkill
252
- rev: v0.5.0
305
+ rev: v0.6.1
253
306
  hooks:
254
307
  - id: leakkill
255
308
  ```
@@ -265,7 +318,13 @@ Or without the framework: `leakkill install-hook`.
265
318
 
266
319
  ## Known limitations
267
320
 
268
- - Detection breadth is close to Gitleaks (whose rules it includes) but below TruffleHog (800+ detectors).
321
+ - Finds fewer real credentials than Betterleaks (recall 0.30 vs 0.38 on real code in CredData, with far fewer
322
+ false alarms), and has fewer rules than Kingfisher or TruffleHog.
323
+ - Scans files, git history and local AI agent files: not Slack, Jira, Confluence, S3 or Docker images.
324
+ - The agent guard is pattern-based: a command that builds a file name at runtime can get past it. The Cursor,
325
+ Copilot and Codex guards are tested against their documented hook formats; only Claude Code was tested in the
326
+ real app. Copilot ignores prompt hooks, so a key typed into a Copilot prompt is warned about, not blocked.
327
+ - `--agents` doesn't read Cursor's chat history (a database), only its MCP config.
269
328
  - On very large repositories (tens of MB) scanning is about 2x slower than Gitleaks.
270
329
  - Verification behind a proxy that injects its own credentials (some corporate and sandbox proxies
271
330
  do) can report the proxy's identity. Run `verify` from a normal network.
@@ -1,2 +1,2 @@
1
1
  """leakkill: find leaked secrets, check if they're live, revoke them, and guard AI coding agents."""
2
- __version__ = "0.5.0"
2
+ __version__ = "0.6.1"