leakkill 0.5.0__tar.gz → 0.6.0__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.
- {leakkill-0.5.0/src/leakkill.egg-info → leakkill-0.6.0}/PKG-INFO +102 -50
- {leakkill-0.5.0 → leakkill-0.6.0}/README.md +101 -49
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill/__init__.py +1 -1
- leakkill-0.6.0/src/leakkill/agents.py +146 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill/cli.py +39 -11
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill/gitleaks_rules.py +16 -16
- leakkill-0.6.0/src/leakkill/guard.py +281 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill/providers.py +2 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill/report.py +14 -8
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill/scanner.py +58 -7
- {leakkill-0.5.0 → leakkill-0.6.0/src/leakkill.egg-info}/PKG-INFO +102 -50
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill.egg-info/SOURCES.txt +3 -0
- leakkill-0.6.0/tests/test_agents.py +88 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/tests/test_cli.py +11 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/tests/test_coverage_gaps.py +1 -1
- leakkill-0.6.0/tests/test_guard_agents.py +162 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/tests/test_import_gitleaks.py +11 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/tests/test_providers.py +4 -2
- {leakkill-0.5.0 → leakkill-0.6.0}/tests/test_scanner.py +38 -0
- leakkill-0.5.0/src/leakkill/guard.py +0 -109
- {leakkill-0.5.0 → leakkill-0.6.0}/LICENSE +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/THIRD_PARTY_NOTICES.md +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/pyproject.toml +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/setup.cfg +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill/__main__.py +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill/aws.py +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill/baseline.py +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill/sarif.py +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill.egg-info/dependency_links.txt +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill.egg-info/entry_points.txt +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/src/leakkill.egg-info/top_level.txt +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/tests/test_fuzz.py +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/tests/test_guard.py +0 -0
- {leakkill-0.5.0 → leakkill-0.6.0}/tests/test_redos.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: leakkill
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
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
|
-
[](https://pypi.org/project/leakkill/) [](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml) [](https://scorecard.dev/viewer/?uri=github.com/ayushanand27/leakkill)
|
|
23
|
+
[](https://pypi.org/project/leakkill/) [](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml) [](https://scorecard.dev/viewer/?uri=github.com/ayushanand27/leakkill) [](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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
@@ -60,10 +61,11 @@ Python 3.9+, no dependencies. Latest development version:
|
|
|
60
61
|
| `leakkill revoke` | Show what can be revoked. With `--yes`, revoke the live ones (`--only 1,3` to pick) | Only with `--yes` |
|
|
61
62
|
| `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
63
|
| `leakkill install-hook` | Git pre-commit hook that blocks commits containing secrets | Never |
|
|
63
|
-
| `leakkill install-
|
|
64
|
+
| `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
65
|
|
|
65
66
|
Every scan command also accepts `--staged` (pre-commit), `--history` (every commit on every branch,
|
|
66
|
-
including secrets you already "deleted"), `--
|
|
67
|
+
including secrets you already "deleted"), `--agents` (secrets your AI coding agents stored on this machine, see
|
|
68
|
+
below), `--exclude-tests` and `--json`.
|
|
67
69
|
|
|
68
70
|
## What it can verify and revoke
|
|
69
71
|
|
|
@@ -76,28 +78,33 @@ including secrets you already "deleted"), `--exclude-tests` and `--json`.
|
|
|
76
78
|
| 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
79
|
| SendGrid (`SG.`) | ✅ scopes | ✅ the key deletes itself if it has API-key permissions |
|
|
78
80
|
| 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 |
|
|
81
|
+
| 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
82
|
|
|
81
83
|
## How it compares
|
|
82
84
|
|
|
83
|
-
| | leakkill | Gitleaks | TruffleHog OSS | GitGuardian |
|
|
84
|
-
|
|
85
|
-
|
|
|
86
|
-
| Runs fully local | ✅ | ✅ | ✅ |
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
85
|
+
| | leakkill | Kingfisher | Betterleaks | Gitleaks | TruffleHog OSS | GitGuardian |
|
|
86
|
+
|---|---|---|---|---|---|---|
|
|
87
|
+
| License / price | MIT, free | Apache 2.0, free | MIT, free | MIT, free | AGPL, free | free for individuals, paid for teams |
|
|
88
|
+
| Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
|
|
89
|
+
| Install | `pip`, zero dependencies | Rust binary | Go binary | Go binary | Go binary | CLI + account |
|
|
90
|
+
| Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
|
|
91
|
+
| Checks if a key is live | ✅ 17 providers | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
|
|
92
|
+
| Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
|
|
93
|
+
| Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
|
|
94
|
+
| Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
|
|
95
|
+
| Scans Slack / Jira / S3 / Docker | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ |
|
|
96
|
+
| SARIF / baselines | ✅ / ✅ hashes only | ✅ / ✅ | ✅ / ✅ | ✅ / ✅ (stores secrets) | ✅ / ❌ | ✅ / ✅ |
|
|
97
|
+
|
|
98
|
+
**Where each is strongest** (accuracy below): Betterleaks finds the most real credentials; Kingfisher has the
|
|
99
|
+
fewest false alarms and the broadest platform coverage with validation and revocation; TruffleHog verifies the
|
|
100
|
+
most providers. leakkill's niche is a dependency-free `pip install` that goes from finding to revoked key to
|
|
101
|
+
cleanup plan, guards AI coding agents, and is the best of these at passwords embedded in URLs and Basic auth headers.
|
|
102
|
+
|
|
103
|
+
Figures from each project's documentation, October 2026. Use what fits: running two scanners is common.
|
|
97
104
|
|
|
98
105
|
### Detection rules
|
|
99
106
|
|
|
100
|
-
leakkill's own
|
|
107
|
+
leakkill's own 32 rules cover the providers it can verify and revoke. On top of those, it includes
|
|
101
108
|
**214 provider rules from [Gitleaks](https://github.com/gitleaks/gitleaks)** (MIT), translated to Python by
|
|
102
109
|
[`tools/import_gitleaks.py`](tools/import_gitleaks.py) from a pinned, checksum-verified release, together with
|
|
103
110
|
Gitleaks' entropy thresholds and allowlists. Thank you to the Gitleaks maintainers. See
|
|
@@ -136,30 +143,38 @@ SendGrid, Telegram) are covered by tests using simulated API responses.
|
|
|
136
143
|
|
|
137
144
|
### Accuracy (independent dataset)
|
|
138
145
|
|
|
139
|
-
On [Samsung CredData](https://github.com/Samsung/CredData), 67,896 lines labeled by people,
|
|
140
|
-
same script
|
|
146
|
+
On [Samsung CredData](https://github.com/Samsung/CredData), 67,896 lines labeled by people, every tool scored
|
|
147
|
+
by the same script ([details and how to reproduce](benchmarks/README.md)):
|
|
141
148
|
|
|
142
|
-
| | precision | recall |
|
|
143
|
-
|
|
144
|
-
| **leakkill** | 0.
|
|
145
|
-
|
|
|
146
|
-
|
|
|
149
|
+
| | precision | recall | F1 | without OpenSSL test vectors (P / R / F1) | passwords in URLs | HTTP Basic auth |
|
|
150
|
+
|---|---|---|---|---|---|---|
|
|
151
|
+
| **leakkill 0.6** | 0.824 | 0.510 | **0.630** | 0.921 / 0.300 / 0.453 | **182/209** | **601/601** |
|
|
152
|
+
| Betterleaks 1.9 | 0.712 | **0.562** | 0.628 | 0.585 / **0.379** / **0.460** | 96/209 | 10/601 |
|
|
153
|
+
| Gitleaks 8.28 | 0.860 | 0.453 | 0.594 | 0.910 / 0.218 / 0.351 | 0/209 | 0/601 |
|
|
154
|
+
| Kingfisher 2.9 (no validation) | **0.961** | 0.104 | 0.187 | **0.925** / 0.079 / 0.145 | 20/209 | 5/601 |
|
|
155
|
+
| TruffleHog 3.97 (no verification) | 0.579 | 0.024 | 0.045 | 0.486 / 0.026 / 0.049 | 59/209 | 0/601 |
|
|
147
156
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
157
|
+
Compare on the "without OpenSSL test vectors" column: those are public crypto test data, not leaks. There,
|
|
158
|
+
leakkill and Betterleaks are level on F1. Betterleaks finds more credentials (recall 0.379 vs 0.300); leakkill
|
|
159
|
+
raises far fewer false alarms (precision 0.921 vs 0.585). leakkill is far ahead on passwords in URLs and Basic
|
|
160
|
+
auth headers, because it decodes and checks them. The generic rules were tuned on this dataset, which flatters
|
|
161
|
+
leakkill somewhat; false alarms on four clean repositories (requests, flask, django, express) stayed at
|
|
162
|
+
1 / 2 / 3 / 0.
|
|
151
163
|
|
|
152
164
|
### How it's tested
|
|
153
165
|
|
|
154
|
-
-
|
|
166
|
+
- 137 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
|
|
155
167
|
- Property-based fuzz tests: the scanner never crashes on random input, never prints a raw secret, finds a
|
|
156
168
|
planted token in any surrounding text, and gives the same answer scanning a whole file or line by line.
|
|
157
169
|
(Fuzzing found two real bugs before release: a guard crash and a slow-input case, both fixed.)
|
|
158
|
-
-
|
|
170
|
+
- Coverage-guided fuzzing with Atheris via ClusterFuzzLite on every pull request and weekly, of the scanner,
|
|
171
|
+
the transcript reader and the AI agent guard. Its first run found a real bug in under a minute: the
|
|
172
|
+
guard could quote a secret hidden in a file name back to the agent. Fixed, with a regression test.
|
|
173
|
+
- Every one of the 246 rules is checked in CI against hostile input built from its own keywords, because
|
|
159
174
|
Python's regex engine, unlike Go's, can be made to backtrack for minutes. The sweep found and fixed 4
|
|
160
175
|
such rules among those imported from Gitleaks.
|
|
161
176
|
- 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.
|
|
177
|
+
- OpenSSF Best Practices (passing), SonarCloud, OpenSSF Scorecard, pinned and hash-locked CI tooling, signed PyPI provenance, Sigstore-signed GitHub releases (see SECURITY.md).
|
|
163
178
|
|
|
164
179
|
## Safety model
|
|
165
180
|
|
|
@@ -170,7 +185,7 @@ False alarms on clean repositories (requests, flask, django, express): 1 / 2 / 3
|
|
|
170
185
|
`GetCallerIdentity` and so on.
|
|
171
186
|
- `revoke` is a dry run unless you pass `--yes`, and only touches keys that verified as live.
|
|
172
187
|
- 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.
|
|
188
|
+
`report --replacements FILE` (needed by `git filter-repo`), which is created with permissions 600 and never overwrites an existing file.
|
|
174
189
|
|
|
175
190
|
## Cleaning git history
|
|
176
191
|
|
|
@@ -183,20 +198,51 @@ rm .leakkill-replacements.txt
|
|
|
183
198
|
git push --force --all && git push --force --tags # every collaborator must re-clone
|
|
184
199
|
```
|
|
185
200
|
|
|
186
|
-
## AI coding agent guard
|
|
201
|
+
## AI coding agent guard
|
|
202
|
+
|
|
203
|
+
```sh
|
|
204
|
+
leakkill install-agent-hooks # all four, in this project
|
|
205
|
+
leakkill install-agent-hooks cursor codex # just these
|
|
206
|
+
leakkill install-agent-hooks --global # for your user account, every project
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
| Agent | Config written | Secret in a prompt | Reading `.env` / keys (file or shell) | Writing a key into code |
|
|
210
|
+
|---|---|---|---|---|
|
|
211
|
+
| Claude Code | `.claude/settings.json` | blocked | blocked | blocked |
|
|
212
|
+
| Cursor | `.cursor/hooks.json` | blocked | blocked, and any file whose content holds a key | blocked |
|
|
213
|
+
| GitHub Copilot CLI | `.github/hooks/leakkill.json` | warned only (Copilot ignores prompt-hook decisions) | blocked | blocked |
|
|
214
|
+
| OpenAI Codex | `.codex/hooks.json` | blocked | blocked | blocked, per file of each `apply_patch` |
|
|
215
|
+
|
|
216
|
+
Sensitive files are `.env` (but not `.env.example`), `*.pem`, `*.key`, `id_rsa`, `.npmrc`, `.pypirc` and
|
|
217
|
+
similar; a shell command that names one (`cat`, `grep`, `base64`, `python -c`, `cp` …) is blocked too.
|
|
218
|
+
Writing keys **into** `.env` is allowed, since that is where they belong. If the guard itself fails, it
|
|
219
|
+
blocks rather than lets a secret through. Codex only runs hooks you trust: after installing, type
|
|
220
|
+
`/hooks` in Codex and trust the leakkill hook.
|
|
221
|
+
|
|
222
|
+
Tested live with the Claude Code CLI: prompts with keys, `Read .env`, `cat .env`, `grep . .env` and
|
|
223
|
+
writing an AWS key into `app.py` were all blocked. Cursor, Copilot and Codex are tested against the hook
|
|
224
|
+
formats in their documentation, through the same command they run; if you see one misbehave, please open
|
|
225
|
+
an issue. The check is pattern-based: a command that builds the file name at runtime can get past it.
|
|
226
|
+
Pair it with OS-level permissions for hard guarantees.
|
|
227
|
+
|
|
228
|
+
## Secrets your AI agents already stored
|
|
229
|
+
|
|
230
|
+
```sh
|
|
231
|
+
leakkill scan --agents # what's there
|
|
232
|
+
leakkill verify --agents # ...and which of those keys still work
|
|
233
|
+
```
|
|
187
234
|
|
|
188
|
-
|
|
235
|
+
AI coding agents keep plain-text session transcripts and prompt histories, and MCP server configs often hold
|
|
236
|
+
API keys. A key you pasted into a chat, or a `.env` the agent read, stays on disk there, and was sent to the
|
|
237
|
+
model provider. `--agents` scans, on your machine only:
|
|
189
238
|
|
|
190
|
-
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
`.env.example` is allowed.
|
|
194
|
-
- writing hard-coded keys into code (writing them into `.env` is allowed)
|
|
239
|
+
- Claude Code (`~/.claude.json`, `~/.claude/` including session transcripts), Codex (`~/.codex/`), GitHub
|
|
240
|
+
Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor, Windsurf, Claude Desktop and VS Code MCP configs
|
|
241
|
+
- this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
|
|
195
242
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
hard guarantees.
|
|
243
|
+
Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
|
|
244
|
+
login files (`~/.codex/auth.json`, `~/.claude/.credentials.json`, Gemini's OAuth file) are skipped, since that is
|
|
245
|
+
where their tokens belong. Cursor's chat history is stored in a database and is not scanned yet.
|
|
200
246
|
|
|
201
247
|
## Use in CI (GitHub Action)
|
|
202
248
|
|
|
@@ -269,7 +315,7 @@ baseline doesn't make it safe: revoke real keys first.
|
|
|
269
315
|
# .pre-commit-config.yaml
|
|
270
316
|
repos:
|
|
271
317
|
- repo: https://github.com/ayushanand27/leakkill
|
|
272
|
-
rev: v0.
|
|
318
|
+
rev: v0.6.0
|
|
273
319
|
hooks:
|
|
274
320
|
- id: leakkill
|
|
275
321
|
```
|
|
@@ -285,7 +331,13 @@ Or without the framework: `leakkill install-hook`.
|
|
|
285
331
|
|
|
286
332
|
## Known limitations
|
|
287
333
|
|
|
288
|
-
-
|
|
334
|
+
- Finds fewer real credentials than Betterleaks (recall 0.30 vs 0.38 on real code in CredData, with far fewer
|
|
335
|
+
false alarms), and has fewer rules than Kingfisher or TruffleHog.
|
|
336
|
+
- Scans files, git history and local AI agent files: not Slack, Jira, Confluence, S3 or Docker images.
|
|
337
|
+
- The agent guard is pattern-based: a command that builds a file name at runtime can get past it. The Cursor,
|
|
338
|
+
Copilot and Codex guards are tested against their documented hook formats; only Claude Code was tested in the
|
|
339
|
+
real app. Copilot ignores prompt hooks, so a key typed into a Copilot prompt is warned about, not blocked.
|
|
340
|
+
- `--agents` doesn't read Cursor's chat history (a database), only its MCP config.
|
|
289
341
|
- On very large repositories (tens of MB) scanning is about 2x slower than Gitleaks.
|
|
290
342
|
- Verification behind a proxy that injects its own credentials (some corporate and sandbox proxies
|
|
291
343
|
do) can report the proxy's identity. Run `verify` from a normal network.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# leakkill
|
|
2
2
|
|
|
3
|
-
[](https://pypi.org/project/leakkill/) [](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml) [](https://scorecard.dev/viewer/?uri=github.com/ayushanand27/leakkill)
|
|
3
|
+
[](https://pypi.org/project/leakkill/) [](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml) [](https://scorecard.dev/viewer/?uri=github.com/ayushanand27/leakkill) [](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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
@@ -40,10 +41,11 @@ Python 3.9+, no dependencies. Latest development version:
|
|
|
40
41
|
| `leakkill revoke` | Show what can be revoked. With `--yes`, revoke the live ones (`--only 1,3` to pick) | Only with `--yes` |
|
|
41
42
|
| `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
43
|
| `leakkill install-hook` | Git pre-commit hook that blocks commits containing secrets | Never |
|
|
43
|
-
| `leakkill install-
|
|
44
|
+
| `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
45
|
|
|
45
46
|
Every scan command also accepts `--staged` (pre-commit), `--history` (every commit on every branch,
|
|
46
|
-
including secrets you already "deleted"), `--
|
|
47
|
+
including secrets you already "deleted"), `--agents` (secrets your AI coding agents stored on this machine, see
|
|
48
|
+
below), `--exclude-tests` and `--json`.
|
|
47
49
|
|
|
48
50
|
## What it can verify and revoke
|
|
49
51
|
|
|
@@ -56,28 +58,33 @@ including secrets you already "deleted"), `--exclude-tests` and `--json`.
|
|
|
56
58
|
| 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
59
|
| SendGrid (`SG.`) | ✅ scopes | ✅ the key deletes itself if it has API-key permissions |
|
|
58
60
|
| 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 |
|
|
61
|
+
| 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
62
|
|
|
61
63
|
## How it compares
|
|
62
64
|
|
|
63
|
-
| | leakkill | Gitleaks | TruffleHog OSS | GitGuardian |
|
|
64
|
-
|
|
65
|
-
|
|
|
66
|
-
| Runs fully local | ✅ | ✅ | ✅ |
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
| | leakkill | Kingfisher | Betterleaks | Gitleaks | TruffleHog OSS | GitGuardian |
|
|
66
|
+
|---|---|---|---|---|---|---|
|
|
67
|
+
| License / price | MIT, free | Apache 2.0, free | MIT, free | MIT, free | AGPL, free | free for individuals, paid for teams |
|
|
68
|
+
| Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
|
|
69
|
+
| Install | `pip`, zero dependencies | Rust binary | Go binary | Go binary | Go binary | CLI + account |
|
|
70
|
+
| Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
|
|
71
|
+
| Checks if a key is live | ✅ 17 providers | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
|
|
72
|
+
| Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
|
|
73
|
+
| Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
|
|
74
|
+
| Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
|
|
75
|
+
| Scans Slack / Jira / S3 / Docker | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ |
|
|
76
|
+
| SARIF / baselines | ✅ / ✅ hashes only | ✅ / ✅ | ✅ / ✅ | ✅ / ✅ (stores secrets) | ✅ / ❌ | ✅ / ✅ |
|
|
77
|
+
|
|
78
|
+
**Where each is strongest** (accuracy below): Betterleaks finds the most real credentials; Kingfisher has the
|
|
79
|
+
fewest false alarms and the broadest platform coverage with validation and revocation; TruffleHog verifies the
|
|
80
|
+
most providers. leakkill's niche is a dependency-free `pip install` that goes from finding to revoked key to
|
|
81
|
+
cleanup plan, guards AI coding agents, and is the best of these at passwords embedded in URLs and Basic auth headers.
|
|
82
|
+
|
|
83
|
+
Figures from each project's documentation, October 2026. Use what fits: running two scanners is common.
|
|
77
84
|
|
|
78
85
|
### Detection rules
|
|
79
86
|
|
|
80
|
-
leakkill's own
|
|
87
|
+
leakkill's own 32 rules cover the providers it can verify and revoke. On top of those, it includes
|
|
81
88
|
**214 provider rules from [Gitleaks](https://github.com/gitleaks/gitleaks)** (MIT), translated to Python by
|
|
82
89
|
[`tools/import_gitleaks.py`](tools/import_gitleaks.py) from a pinned, checksum-verified release, together with
|
|
83
90
|
Gitleaks' entropy thresholds and allowlists. Thank you to the Gitleaks maintainers. See
|
|
@@ -116,30 +123,38 @@ SendGrid, Telegram) are covered by tests using simulated API responses.
|
|
|
116
123
|
|
|
117
124
|
### Accuracy (independent dataset)
|
|
118
125
|
|
|
119
|
-
On [Samsung CredData](https://github.com/Samsung/CredData), 67,896 lines labeled by people,
|
|
120
|
-
same script
|
|
126
|
+
On [Samsung CredData](https://github.com/Samsung/CredData), 67,896 lines labeled by people, every tool scored
|
|
127
|
+
by the same script ([details and how to reproduce](benchmarks/README.md)):
|
|
121
128
|
|
|
122
|
-
| | precision | recall |
|
|
123
|
-
|
|
124
|
-
| **leakkill** | 0.
|
|
125
|
-
|
|
|
126
|
-
|
|
|
129
|
+
| | precision | recall | F1 | without OpenSSL test vectors (P / R / F1) | passwords in URLs | HTTP Basic auth |
|
|
130
|
+
|---|---|---|---|---|---|---|
|
|
131
|
+
| **leakkill 0.6** | 0.824 | 0.510 | **0.630** | 0.921 / 0.300 / 0.453 | **182/209** | **601/601** |
|
|
132
|
+
| Betterleaks 1.9 | 0.712 | **0.562** | 0.628 | 0.585 / **0.379** / **0.460** | 96/209 | 10/601 |
|
|
133
|
+
| Gitleaks 8.28 | 0.860 | 0.453 | 0.594 | 0.910 / 0.218 / 0.351 | 0/209 | 0/601 |
|
|
134
|
+
| Kingfisher 2.9 (no validation) | **0.961** | 0.104 | 0.187 | **0.925** / 0.079 / 0.145 | 20/209 | 5/601 |
|
|
135
|
+
| TruffleHog 3.97 (no verification) | 0.579 | 0.024 | 0.045 | 0.486 / 0.026 / 0.049 | 59/209 | 0/601 |
|
|
127
136
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
137
|
+
Compare on the "without OpenSSL test vectors" column: those are public crypto test data, not leaks. There,
|
|
138
|
+
leakkill and Betterleaks are level on F1. Betterleaks finds more credentials (recall 0.379 vs 0.300); leakkill
|
|
139
|
+
raises far fewer false alarms (precision 0.921 vs 0.585). leakkill is far ahead on passwords in URLs and Basic
|
|
140
|
+
auth headers, because it decodes and checks them. The generic rules were tuned on this dataset, which flatters
|
|
141
|
+
leakkill somewhat; false alarms on four clean repositories (requests, flask, django, express) stayed at
|
|
142
|
+
1 / 2 / 3 / 0.
|
|
131
143
|
|
|
132
144
|
### How it's tested
|
|
133
145
|
|
|
134
|
-
-
|
|
146
|
+
- 137 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
|
|
135
147
|
- Property-based fuzz tests: the scanner never crashes on random input, never prints a raw secret, finds a
|
|
136
148
|
planted token in any surrounding text, and gives the same answer scanning a whole file or line by line.
|
|
137
149
|
(Fuzzing found two real bugs before release: a guard crash and a slow-input case, both fixed.)
|
|
138
|
-
-
|
|
150
|
+
- Coverage-guided fuzzing with Atheris via ClusterFuzzLite on every pull request and weekly, of the scanner,
|
|
151
|
+
the transcript reader and the AI agent guard. Its first run found a real bug in under a minute: the
|
|
152
|
+
guard could quote a secret hidden in a file name back to the agent. Fixed, with a regression test.
|
|
153
|
+
- Every one of the 246 rules is checked in CI against hostile input built from its own keywords, because
|
|
139
154
|
Python's regex engine, unlike Go's, can be made to backtrack for minutes. The sweep found and fixed 4
|
|
140
155
|
such rules among those imported from Gitleaks.
|
|
141
156
|
- 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.
|
|
157
|
+
- OpenSSF Best Practices (passing), SonarCloud, OpenSSF Scorecard, pinned and hash-locked CI tooling, signed PyPI provenance, Sigstore-signed GitHub releases (see SECURITY.md).
|
|
143
158
|
|
|
144
159
|
## Safety model
|
|
145
160
|
|
|
@@ -150,7 +165,7 @@ False alarms on clean repositories (requests, flask, django, express): 1 / 2 / 3
|
|
|
150
165
|
`GetCallerIdentity` and so on.
|
|
151
166
|
- `revoke` is a dry run unless you pass `--yes`, and only touches keys that verified as live.
|
|
152
167
|
- 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.
|
|
168
|
+
`report --replacements FILE` (needed by `git filter-repo`), which is created with permissions 600 and never overwrites an existing file.
|
|
154
169
|
|
|
155
170
|
## Cleaning git history
|
|
156
171
|
|
|
@@ -163,20 +178,51 @@ rm .leakkill-replacements.txt
|
|
|
163
178
|
git push --force --all && git push --force --tags # every collaborator must re-clone
|
|
164
179
|
```
|
|
165
180
|
|
|
166
|
-
## AI coding agent guard
|
|
181
|
+
## AI coding agent guard
|
|
182
|
+
|
|
183
|
+
```sh
|
|
184
|
+
leakkill install-agent-hooks # all four, in this project
|
|
185
|
+
leakkill install-agent-hooks cursor codex # just these
|
|
186
|
+
leakkill install-agent-hooks --global # for your user account, every project
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
| Agent | Config written | Secret in a prompt | Reading `.env` / keys (file or shell) | Writing a key into code |
|
|
190
|
+
|---|---|---|---|---|
|
|
191
|
+
| Claude Code | `.claude/settings.json` | blocked | blocked | blocked |
|
|
192
|
+
| Cursor | `.cursor/hooks.json` | blocked | blocked, and any file whose content holds a key | blocked |
|
|
193
|
+
| GitHub Copilot CLI | `.github/hooks/leakkill.json` | warned only (Copilot ignores prompt-hook decisions) | blocked | blocked |
|
|
194
|
+
| OpenAI Codex | `.codex/hooks.json` | blocked | blocked | blocked, per file of each `apply_patch` |
|
|
195
|
+
|
|
196
|
+
Sensitive files are `.env` (but not `.env.example`), `*.pem`, `*.key`, `id_rsa`, `.npmrc`, `.pypirc` and
|
|
197
|
+
similar; a shell command that names one (`cat`, `grep`, `base64`, `python -c`, `cp` …) is blocked too.
|
|
198
|
+
Writing keys **into** `.env` is allowed, since that is where they belong. If the guard itself fails, it
|
|
199
|
+
blocks rather than lets a secret through. Codex only runs hooks you trust: after installing, type
|
|
200
|
+
`/hooks` in Codex and trust the leakkill hook.
|
|
201
|
+
|
|
202
|
+
Tested live with the Claude Code CLI: prompts with keys, `Read .env`, `cat .env`, `grep . .env` and
|
|
203
|
+
writing an AWS key into `app.py` were all blocked. Cursor, Copilot and Codex are tested against the hook
|
|
204
|
+
formats in their documentation, through the same command they run; if you see one misbehave, please open
|
|
205
|
+
an issue. The check is pattern-based: a command that builds the file name at runtime can get past it.
|
|
206
|
+
Pair it with OS-level permissions for hard guarantees.
|
|
207
|
+
|
|
208
|
+
## Secrets your AI agents already stored
|
|
209
|
+
|
|
210
|
+
```sh
|
|
211
|
+
leakkill scan --agents # what's there
|
|
212
|
+
leakkill verify --agents # ...and which of those keys still work
|
|
213
|
+
```
|
|
167
214
|
|
|
168
|
-
|
|
215
|
+
AI coding agents keep plain-text session transcripts and prompt histories, and MCP server configs often hold
|
|
216
|
+
API keys. A key you pasted into a chat, or a `.env` the agent read, stays on disk there, and was sent to the
|
|
217
|
+
model provider. `--agents` scans, on your machine only:
|
|
169
218
|
|
|
170
|
-
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
`.env.example` is allowed.
|
|
174
|
-
- writing hard-coded keys into code (writing them into `.env` is allowed)
|
|
219
|
+
- Claude Code (`~/.claude.json`, `~/.claude/` including session transcripts), Codex (`~/.codex/`), GitHub
|
|
220
|
+
Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor, Windsurf, Claude Desktop and VS Code MCP configs
|
|
221
|
+
- this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
|
|
175
222
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
hard guarantees.
|
|
223
|
+
Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
|
|
224
|
+
login files (`~/.codex/auth.json`, `~/.claude/.credentials.json`, Gemini's OAuth file) are skipped, since that is
|
|
225
|
+
where their tokens belong. Cursor's chat history is stored in a database and is not scanned yet.
|
|
180
226
|
|
|
181
227
|
## Use in CI (GitHub Action)
|
|
182
228
|
|
|
@@ -249,7 +295,7 @@ baseline doesn't make it safe: revoke real keys first.
|
|
|
249
295
|
# .pre-commit-config.yaml
|
|
250
296
|
repos:
|
|
251
297
|
- repo: https://github.com/ayushanand27/leakkill
|
|
252
|
-
rev: v0.
|
|
298
|
+
rev: v0.6.0
|
|
253
299
|
hooks:
|
|
254
300
|
- id: leakkill
|
|
255
301
|
```
|
|
@@ -265,7 +311,13 @@ Or without the framework: `leakkill install-hook`.
|
|
|
265
311
|
|
|
266
312
|
## Known limitations
|
|
267
313
|
|
|
268
|
-
-
|
|
314
|
+
- Finds fewer real credentials than Betterleaks (recall 0.30 vs 0.38 on real code in CredData, with far fewer
|
|
315
|
+
false alarms), and has fewer rules than Kingfisher or TruffleHog.
|
|
316
|
+
- Scans files, git history and local AI agent files: not Slack, Jira, Confluence, S3 or Docker images.
|
|
317
|
+
- The agent guard is pattern-based: a command that builds a file name at runtime can get past it. The Cursor,
|
|
318
|
+
Copilot and Codex guards are tested against their documented hook formats; only Claude Code was tested in the
|
|
319
|
+
real app. Copilot ignores prompt hooks, so a key typed into a Copilot prompt is warned about, not blocked.
|
|
320
|
+
- `--agents` doesn't read Cursor's chat history (a database), only its MCP config.
|
|
269
321
|
- On very large repositories (tens of MB) scanning is about 2x slower than Gitleaks.
|
|
270
322
|
- Verification behind a proxy that injects its own credentials (some corporate and sandbox proxies
|
|
271
323
|
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.
|
|
2
|
+
__version__ = "0.6.0"
|