leakkill 0.6.0__tar.gz → 0.7.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.6.0/src/leakkill.egg-info → leakkill-0.7.0}/PKG-INFO +19 -12
- {leakkill-0.6.0 → leakkill-0.7.0}/README.md +18 -11
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill/__init__.py +1 -1
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill/agents.py +57 -3
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill/providers.py +113 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill/report.py +1 -1
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill/scanner.py +9 -1
- {leakkill-0.6.0 → leakkill-0.7.0/src/leakkill.egg-info}/PKG-INFO +19 -12
- {leakkill-0.6.0 → leakkill-0.7.0}/tests/test_agents.py +21 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/tests/test_coverage_gaps.py +2 -2
- {leakkill-0.6.0 → leakkill-0.7.0}/tests/test_providers.py +42 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/tests/test_scanner.py +7 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/LICENSE +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/THIRD_PARTY_NOTICES.md +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/pyproject.toml +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/setup.cfg +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill/__main__.py +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill/aws.py +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill/baseline.py +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill/cli.py +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill/gitleaks_rules.py +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill/guard.py +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill/sarif.py +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill.egg-info/SOURCES.txt +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill.egg-info/dependency_links.txt +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill.egg-info/entry_points.txt +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/src/leakkill.egg-info/top_level.txt +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/tests/test_cli.py +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/tests/test_fuzz.py +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/tests/test_guard.py +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/tests/test_guard_agents.py +0 -0
- {leakkill-0.6.0 → leakkill-0.7.0}/tests/test_import_gitleaks.py +0 -0
- {leakkill-0.6.0 → leakkill-0.7.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.7.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
|
|
@@ -52,6 +52,13 @@ pip install leakkill
|
|
|
52
52
|
Python 3.9+, no dependencies. Latest development version:
|
|
53
53
|
`pip install git+https://github.com/ayushanand27/leakkill`
|
|
54
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
|
+
|
|
55
62
|
## Commands
|
|
56
63
|
|
|
57
64
|
| Command | What it does | Network? |
|
|
@@ -78,7 +85,8 @@ below), `--exclude-tests` and `--json`.
|
|
|
78
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 |
|
|
79
86
|
| SendGrid (`SG.`) | ✅ scopes | ✅ the key deletes itself if it has API-key permissions |
|
|
80
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 |
|
|
81
|
-
|
|
|
88
|
+
| Postman, Linear, Notion, Sentry, Netlify, Doppler, Pulumi, Heroku, Brevo, Square, Airtable, Dropbox, LaunchDarkly, Cloudflare, Mailchimp | ✅ (account where the API returns it); live only on HTTP 200, dead only on 401 | ❌ you get the exact page to revoke it |
|
|
89
|
+
| Google API keys, Shopify, PyPI, Docker Hub, Twilio, Perplexity, Azure Storage, private keys, JWTs, credentials in URLs and Basic auth headers, generic high-entropy secrets | detected, not verified | step-by-step rotation guidance |
|
|
82
90
|
|
|
83
91
|
## How it compares
|
|
84
92
|
|
|
@@ -86,9 +94,9 @@ below), `--exclude-tests` and `--json`.
|
|
|
86
94
|
|---|---|---|---|---|---|---|
|
|
87
95
|
| License / price | MIT, free | Apache 2.0, free | MIT, free | MIT, free | AGPL, free | free for individuals, paid for teams |
|
|
88
96
|
| Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
|
|
89
|
-
| Install | `pip
|
|
97
|
+
| Install | `pip` (zero dependencies) or Docker | Rust binary | Go binary | Go binary | Go binary | CLI + account |
|
|
90
98
|
| Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
|
|
91
|
-
| Checks if a key is live | ✅
|
|
99
|
+
| Checks if a key is live | ✅ 32 services | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
|
|
92
100
|
| Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
|
|
93
101
|
| Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
|
|
94
102
|
| Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
|
|
@@ -139,7 +147,7 @@ End to end on Windows with real, throwaway credentials:
|
|
|
139
147
|
|
|
140
148
|
Against the real AWS, GitLab, Anthropic and npm APIs, invalid keys are correctly reported DEAD.
|
|
141
149
|
Providers not yet tested with a live key (OpenAI, OpenRouter, Groq, Replicate, DigitalOcean,
|
|
142
|
-
SendGrid, Telegram) are covered by tests using simulated API responses.
|
|
150
|
+
SendGrid, Telegram, and the 15 added in 0.7) are covered by tests using simulated API responses.
|
|
143
151
|
|
|
144
152
|
### Accuracy (independent dataset)
|
|
145
153
|
|
|
@@ -148,7 +156,7 @@ by the same script ([details and how to reproduce](benchmarks/README.md)):
|
|
|
148
156
|
|
|
149
157
|
| | precision | recall | F1 | without OpenSSL test vectors (P / R / F1) | passwords in URLs | HTTP Basic auth |
|
|
150
158
|
|---|---|---|---|---|---|---|
|
|
151
|
-
| **leakkill 0.6** | 0.
|
|
159
|
+
| **leakkill 0.6** | 0.825 | 0.510 | **0.630** | 0.922 / 0.300 / 0.453 | **182/209** | **601/601** |
|
|
152
160
|
| Betterleaks 1.9 | 0.712 | **0.562** | 0.628 | 0.585 / **0.379** / **0.460** | 96/209 | 10/601 |
|
|
153
161
|
| Gitleaks 8.28 | 0.860 | 0.453 | 0.594 | 0.910 / 0.218 / 0.351 | 0/209 | 0/601 |
|
|
154
162
|
| Kingfisher 2.9 (no validation) | **0.961** | 0.104 | 0.187 | **0.925** / 0.079 / 0.145 | 20/209 | 5/601 |
|
|
@@ -156,14 +164,14 @@ by the same script ([details and how to reproduce](benchmarks/README.md)):
|
|
|
156
164
|
|
|
157
165
|
Compare on the "without OpenSSL test vectors" column: those are public crypto test data, not leaks. There,
|
|
158
166
|
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.
|
|
167
|
+
raises far fewer false alarms (precision 0.922 vs 0.585). leakkill is far ahead on passwords in URLs and Basic
|
|
160
168
|
auth headers, because it decodes and checks them. The generic rules were tuned on this dataset, which flatters
|
|
161
169
|
leakkill somewhat; false alarms on four clean repositories (requests, flask, django, express) stayed at
|
|
162
170
|
1 / 2 / 3 / 0.
|
|
163
171
|
|
|
164
172
|
### How it's tested
|
|
165
173
|
|
|
166
|
-
-
|
|
174
|
+
- 154 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
|
|
167
175
|
- Property-based fuzz tests: the scanner never crashes on random input, never prints a raw secret, finds a
|
|
168
176
|
planted token in any surrounding text, and gives the same answer scanning a whole file or line by line.
|
|
169
177
|
(Fuzzing found two real bugs before release: a guard crash and a slow-input case, both fixed.)
|
|
@@ -237,12 +245,12 @@ API keys. A key you pasted into a chat, or a `.env` the agent read, stays on dis
|
|
|
237
245
|
model provider. `--agents` scans, on your machine only:
|
|
238
246
|
|
|
239
247
|
- 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
|
|
248
|
+
Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor and VS Code (Copilot Chat) chat histories, Cursor, Windsurf, Claude Desktop and VS Code MCP configs
|
|
241
249
|
- this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
|
|
242
250
|
|
|
243
251
|
Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
|
|
244
252
|
login files (`~/.codex/auth.json`, `~/.claude/.credentials.json`, Gemini's OAuth file) are skipped, since that is
|
|
245
|
-
where their tokens belong. Cursor
|
|
253
|
+
where their tokens belong. Cursor and VS Code keep chats in SQLite databases (`state.vscdb`); they are opened read-only, so a running editor is never disturbed.
|
|
246
254
|
|
|
247
255
|
## Use in CI (GitHub Action)
|
|
248
256
|
|
|
@@ -315,7 +323,7 @@ baseline doesn't make it safe: revoke real keys first.
|
|
|
315
323
|
# .pre-commit-config.yaml
|
|
316
324
|
repos:
|
|
317
325
|
- repo: https://github.com/ayushanand27/leakkill
|
|
318
|
-
rev: v0.
|
|
326
|
+
rev: v0.7.0
|
|
319
327
|
hooks:
|
|
320
328
|
- id: leakkill
|
|
321
329
|
```
|
|
@@ -337,7 +345,6 @@ Or without the framework: `leakkill install-hook`.
|
|
|
337
345
|
- The agent guard is pattern-based: a command that builds a file name at runtime can get past it. The Cursor,
|
|
338
346
|
Copilot and Codex guards are tested against their documented hook formats; only Claude Code was tested in the
|
|
339
347
|
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.
|
|
341
348
|
- On very large repositories (tens of MB) scanning is about 2x slower than Gitleaks.
|
|
342
349
|
- Verification behind a proxy that injects its own credentials (some corporate and sandbox proxies
|
|
343
350
|
do) can report the proxy's identity. Run `verify` from a normal network.
|
|
@@ -32,6 +32,13 @@ pip install leakkill
|
|
|
32
32
|
Python 3.9+, no dependencies. Latest development version:
|
|
33
33
|
`pip install git+https://github.com/ayushanand27/leakkill`
|
|
34
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
|
+
|
|
35
42
|
## Commands
|
|
36
43
|
|
|
37
44
|
| Command | What it does | Network? |
|
|
@@ -58,7 +65,8 @@ below), `--exclude-tests` and `--json`.
|
|
|
58
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 |
|
|
59
66
|
| SendGrid (`SG.`) | ✅ scopes | ✅ the key deletes itself if it has API-key permissions |
|
|
60
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 |
|
|
61
|
-
|
|
|
68
|
+
| Postman, Linear, Notion, Sentry, Netlify, Doppler, Pulumi, Heroku, Brevo, Square, Airtable, Dropbox, LaunchDarkly, Cloudflare, Mailchimp | ✅ (account where the API returns it); live only on HTTP 200, dead only on 401 | ❌ you get the exact page to revoke it |
|
|
69
|
+
| Google API keys, Shopify, PyPI, Docker Hub, Twilio, Perplexity, Azure Storage, private keys, JWTs, credentials in URLs and Basic auth headers, generic high-entropy secrets | detected, not verified | step-by-step rotation guidance |
|
|
62
70
|
|
|
63
71
|
## How it compares
|
|
64
72
|
|
|
@@ -66,9 +74,9 @@ below), `--exclude-tests` and `--json`.
|
|
|
66
74
|
|---|---|---|---|---|---|---|
|
|
67
75
|
| License / price | MIT, free | Apache 2.0, free | MIT, free | MIT, free | AGPL, free | free for individuals, paid for teams |
|
|
68
76
|
| Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
|
|
69
|
-
| Install | `pip
|
|
77
|
+
| Install | `pip` (zero dependencies) or Docker | Rust binary | Go binary | Go binary | Go binary | CLI + account |
|
|
70
78
|
| Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
|
|
71
|
-
| Checks if a key is live | ✅
|
|
79
|
+
| Checks if a key is live | ✅ 32 services | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
|
|
72
80
|
| Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
|
|
73
81
|
| Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
|
|
74
82
|
| Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
|
|
@@ -119,7 +127,7 @@ End to end on Windows with real, throwaway credentials:
|
|
|
119
127
|
|
|
120
128
|
Against the real AWS, GitLab, Anthropic and npm APIs, invalid keys are correctly reported DEAD.
|
|
121
129
|
Providers not yet tested with a live key (OpenAI, OpenRouter, Groq, Replicate, DigitalOcean,
|
|
122
|
-
SendGrid, Telegram) are covered by tests using simulated API responses.
|
|
130
|
+
SendGrid, Telegram, and the 15 added in 0.7) are covered by tests using simulated API responses.
|
|
123
131
|
|
|
124
132
|
### Accuracy (independent dataset)
|
|
125
133
|
|
|
@@ -128,7 +136,7 @@ by the same script ([details and how to reproduce](benchmarks/README.md)):
|
|
|
128
136
|
|
|
129
137
|
| | precision | recall | F1 | without OpenSSL test vectors (P / R / F1) | passwords in URLs | HTTP Basic auth |
|
|
130
138
|
|---|---|---|---|---|---|---|
|
|
131
|
-
| **leakkill 0.6** | 0.
|
|
139
|
+
| **leakkill 0.6** | 0.825 | 0.510 | **0.630** | 0.922 / 0.300 / 0.453 | **182/209** | **601/601** |
|
|
132
140
|
| Betterleaks 1.9 | 0.712 | **0.562** | 0.628 | 0.585 / **0.379** / **0.460** | 96/209 | 10/601 |
|
|
133
141
|
| Gitleaks 8.28 | 0.860 | 0.453 | 0.594 | 0.910 / 0.218 / 0.351 | 0/209 | 0/601 |
|
|
134
142
|
| Kingfisher 2.9 (no validation) | **0.961** | 0.104 | 0.187 | **0.925** / 0.079 / 0.145 | 20/209 | 5/601 |
|
|
@@ -136,14 +144,14 @@ by the same script ([details and how to reproduce](benchmarks/README.md)):
|
|
|
136
144
|
|
|
137
145
|
Compare on the "without OpenSSL test vectors" column: those are public crypto test data, not leaks. There,
|
|
138
146
|
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.
|
|
147
|
+
raises far fewer false alarms (precision 0.922 vs 0.585). leakkill is far ahead on passwords in URLs and Basic
|
|
140
148
|
auth headers, because it decodes and checks them. The generic rules were tuned on this dataset, which flatters
|
|
141
149
|
leakkill somewhat; false alarms on four clean repositories (requests, flask, django, express) stayed at
|
|
142
150
|
1 / 2 / 3 / 0.
|
|
143
151
|
|
|
144
152
|
### How it's tested
|
|
145
153
|
|
|
146
|
-
-
|
|
154
|
+
- 154 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
|
|
147
155
|
- Property-based fuzz tests: the scanner never crashes on random input, never prints a raw secret, finds a
|
|
148
156
|
planted token in any surrounding text, and gives the same answer scanning a whole file or line by line.
|
|
149
157
|
(Fuzzing found two real bugs before release: a guard crash and a slow-input case, both fixed.)
|
|
@@ -217,12 +225,12 @@ API keys. A key you pasted into a chat, or a `.env` the agent read, stays on dis
|
|
|
217
225
|
model provider. `--agents` scans, on your machine only:
|
|
218
226
|
|
|
219
227
|
- 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
|
|
228
|
+
Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor and VS Code (Copilot Chat) chat histories, Cursor, Windsurf, Claude Desktop and VS Code MCP configs
|
|
221
229
|
- this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
|
|
222
230
|
|
|
223
231
|
Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
|
|
224
232
|
login files (`~/.codex/auth.json`, `~/.claude/.credentials.json`, Gemini's OAuth file) are skipped, since that is
|
|
225
|
-
where their tokens belong. Cursor
|
|
233
|
+
where their tokens belong. Cursor and VS Code keep chats in SQLite databases (`state.vscdb`); they are opened read-only, so a running editor is never disturbed.
|
|
226
234
|
|
|
227
235
|
## Use in CI (GitHub Action)
|
|
228
236
|
|
|
@@ -295,7 +303,7 @@ baseline doesn't make it safe: revoke real keys first.
|
|
|
295
303
|
# .pre-commit-config.yaml
|
|
296
304
|
repos:
|
|
297
305
|
- repo: https://github.com/ayushanand27/leakkill
|
|
298
|
-
rev: v0.
|
|
306
|
+
rev: v0.7.0
|
|
299
307
|
hooks:
|
|
300
308
|
- id: leakkill
|
|
301
309
|
```
|
|
@@ -317,7 +325,6 @@ Or without the framework: `leakkill install-hook`.
|
|
|
317
325
|
- The agent guard is pattern-based: a command that builds a file name at runtime can get past it. The Cursor,
|
|
318
326
|
Copilot and Codex guards are tested against their documented hook formats; only Claude Code was tested in the
|
|
319
327
|
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.
|
|
321
328
|
- On very large repositories (tens of MB) scanning is about 2x slower than Gitleaks.
|
|
322
329
|
- Verification behind a proxy that injects its own credentials (some corporate and sandbox proxies
|
|
323
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.
|
|
2
|
+
__version__ = "0.7.0"
|
|
@@ -4,7 +4,7 @@ plain text, and was sent to the model provider).
|
|
|
4
4
|
|
|
5
5
|
Credential stores the agents are meant to use (e.g. ~/.codex/auth.json) are skipped: that is where tokens belong.
|
|
6
6
|
"""
|
|
7
|
-
import functools, json, os, sys
|
|
7
|
+
import functools, glob, json, os, pathlib, sqlite3, sys
|
|
8
8
|
|
|
9
9
|
from .scanner import _parallel, scan_text
|
|
10
10
|
|
|
@@ -29,6 +29,11 @@ ENV_HOMES = {"CLAUDE_CONFIG_DIR": "Claude Code", "CODEX_HOME": "Codex", "COPILOT
|
|
|
29
29
|
SKIP_NAMES = {".credentials.json", "auth.json", "oauth_creds.json", "google_accounts.json", "plugins", "extensions",
|
|
30
30
|
"node_modules", "pkg", "statsig", "ide", ".git", "cache", "Cache"}
|
|
31
31
|
TEXT_EXT = {".json", ".jsonl", ".toml", ".yaml", ".yml", ".md", ".txt", ".log", ".env", ".sh", ".ini", ".cfg", ""}
|
|
32
|
+
# Cursor and VS Code (Copilot Chat) keep chats in SQLite databases (state.vscdb) under the editor's user folder.
|
|
33
|
+
EDITOR_DIRS = {"Cursor": ["Library/Application Support/Cursor/User", ".config/Cursor/User"],
|
|
34
|
+
"VS Code": ["Library/Application Support/Code/User", ".config/Code/User"]}
|
|
35
|
+
EDITOR_APPDATA = {"Cursor": "Cursor/User", "VS Code": "Code/User"}
|
|
36
|
+
DB_TABLES = ("ItemTable", "cursorDiskKV") # key/value tables; chats are JSON values
|
|
32
37
|
MAX_FILE = 500_000_000
|
|
33
38
|
CHUNK = 1_000_000
|
|
34
39
|
|
|
@@ -130,15 +135,64 @@ def scan_file(path, home=None):
|
|
|
130
135
|
return []
|
|
131
136
|
|
|
132
137
|
|
|
138
|
+
def editor_dbs(home=None, env=None):
|
|
139
|
+
"""[(agent, state.vscdb path)] for Cursor and VS Code on this machine."""
|
|
140
|
+
home = home or os.path.expanduser("~")
|
|
141
|
+
env = os.environ if env is None else env
|
|
142
|
+
roots = [(a, os.path.join(home, d)) for a, ds in EDITOR_DIRS.items() for d in ds]
|
|
143
|
+
if env.get("APPDATA"):
|
|
144
|
+
roots += [(a, os.path.join(env["APPDATA"], d)) for a, d in EDITOR_APPDATA.items()]
|
|
145
|
+
found = []
|
|
146
|
+
for agent, root in roots:
|
|
147
|
+
for db in [os.path.join(root, "globalStorage", "state.vscdb")] + sorted(
|
|
148
|
+
glob.glob(os.path.join(glob.escape(root), "workspaceStorage", "*", "state.vscdb"))):
|
|
149
|
+
if os.path.isfile(db):
|
|
150
|
+
found.append((agent, db))
|
|
151
|
+
return found
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _db_rows(con, table):
|
|
155
|
+
for rowid, value in con.execute(f"SELECT rowid, value FROM {table}"): # table names are our constants
|
|
156
|
+
if isinstance(value, bytes):
|
|
157
|
+
value = value.decode("utf-8", "replace")
|
|
158
|
+
if not isinstance(value, str) or len(value) > 20_000_000:
|
|
159
|
+
continue
|
|
160
|
+
try:
|
|
161
|
+
value = "\n".join(_strings(json.loads(value)))
|
|
162
|
+
except ValueError:
|
|
163
|
+
pass
|
|
164
|
+
yield rowid, value
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def scan_db(path, home=None):
|
|
168
|
+
"""Read an editor's state.vscdb read-only and scan its chat/key-value rows; findings point at table:rowid."""
|
|
169
|
+
home = home or os.path.expanduser("~")
|
|
170
|
+
display = _display(path, home)
|
|
171
|
+
found = []
|
|
172
|
+
try: # read-only; immutable=1 skips locking so a running editor isn't disturbed
|
|
173
|
+
con = sqlite3.connect(pathlib.Path(path).resolve().as_uri() + "?mode=ro&immutable=1", uri=True)
|
|
174
|
+
try:
|
|
175
|
+
tables = {r[0] for r in con.execute("SELECT name FROM sqlite_master WHERE type='table'")}
|
|
176
|
+
for table in DB_TABLES:
|
|
177
|
+
if table in tables:
|
|
178
|
+
found += _scan_stream(_db_rows(con, table), f"{display}#{table}")
|
|
179
|
+
finally:
|
|
180
|
+
con.close()
|
|
181
|
+
except sqlite3.Error:
|
|
182
|
+
return []
|
|
183
|
+
return found
|
|
184
|
+
|
|
185
|
+
|
|
133
186
|
def scan_agents(home=None, cwd=None, env=None, quiet=False):
|
|
134
187
|
"""Scan every agent location found; return Findings with ~-relative paths."""
|
|
135
188
|
home = home or os.path.expanduser("~")
|
|
136
189
|
where = places(home, cwd, env)
|
|
190
|
+
dbs = editor_dbs(home, env)
|
|
137
191
|
if not quiet:
|
|
138
|
-
names = ", ".join(dict.fromkeys(a for a, _ in where)) or "none found"
|
|
192
|
+
names = ", ".join(dict.fromkeys(a for a, _ in where + dbs)) or "none found"
|
|
139
193
|
print(f"Scanning AI agent files: {names}", file=sys.stderr)
|
|
140
194
|
files = list(dict.fromkeys(f for _, p in where for f in _files(p)))
|
|
141
|
-
return _parallel(functools.partial(scan_file, home=home), files)
|
|
195
|
+
return _parallel(functools.partial(scan_file, home=home), files) + [f for _, db in dbs for f in scan_db(db, home)]
|
|
142
196
|
|
|
143
197
|
|
|
144
198
|
ADVICE = ("Secrets in agent transcripts and histories were sent to the model provider and sit on disk in plain "
|
|
@@ -278,6 +278,98 @@ def sendgrid_revoke(s, res):
|
|
|
278
278
|
return False, f"HTTP {code}: this key can't delete itself, use the dashboard"
|
|
279
279
|
|
|
280
280
|
|
|
281
|
+
# ---------------------------------------------------------------- more "who am I" checks (live = 200, dead = 401 only)
|
|
282
|
+
def _who(url, headers, pick=lambda j: "", method="GET", data=None):
|
|
283
|
+
code, _, body = http(method, url, headers, data)
|
|
284
|
+
if code == 200:
|
|
285
|
+
try:
|
|
286
|
+
ident = pick(_json(body)) or ""
|
|
287
|
+
except (AttributeError, TypeError, KeyError):
|
|
288
|
+
ident = ""
|
|
289
|
+
return Result(LIVE, str(ident))
|
|
290
|
+
return _by_status(code)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def _bearer(s, **extra):
|
|
294
|
+
return {"Authorization": f"Bearer {s}", **extra}
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def postman_verify(s, ctx):
|
|
298
|
+
return _who("https://api.getpostman.com/me", {"X-Api-Key": s}, lambda j: j["user"]["username"])
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def linear_verify(s, ctx):
|
|
302
|
+
return _who("https://api.linear.app/graphql", {"Authorization": s, "Content-Type": "application/json"},
|
|
303
|
+
lambda j: j["data"]["viewer"]["email"], "POST", b'{"query":"{ viewer { email } }"}')
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def notion_verify(s, ctx):
|
|
307
|
+
return _who("https://api.notion.com/v1/users/me", _bearer(s, **{"Notion-Version": "2022-06-28"}),
|
|
308
|
+
lambda j: j.get("name"))
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
def sentry_verify(s, ctx):
|
|
312
|
+
return _who("https://sentry.io/api/0/", _bearer(s), lambda j: (j.get("user") or {}).get("email"))
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def netlify_verify(s, ctx):
|
|
316
|
+
return _who("https://api.netlify.com/api/v1/user", _bearer(s), lambda j: j.get("email"))
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
def doppler_verify(s, ctx):
|
|
320
|
+
return _who("https://api.doppler.com/v3/me", _bearer(s), lambda j: (j.get("workplace") or {}).get("name"))
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def pulumi_verify(s, ctx):
|
|
324
|
+
return _who("https://api.pulumi.com/api/user", {"Authorization": f"token {s}"},
|
|
325
|
+
lambda j: j.get("githubLogin") or j.get("name"))
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def heroku_verify(s, ctx):
|
|
329
|
+
return _who("https://api.heroku.com/account", _bearer(s, Accept="application/vnd.heroku+json; version=3"),
|
|
330
|
+
lambda j: j.get("email"))
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def brevo_verify(s, ctx):
|
|
334
|
+
return _who("https://api.brevo.com/v3/account", {"api-key": s}, lambda j: j.get("email"))
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
def square_verify(s, ctx):
|
|
338
|
+
return _who("https://connect.squareup.com/v2/merchants/me", _bearer(s),
|
|
339
|
+
lambda j: (j.get("merchant") or {}).get("business_name"))
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
def airtable_verify(s, ctx):
|
|
343
|
+
return _who("https://api.airtable.com/v0/meta/whoami", _bearer(s), lambda j: j.get("email") or j.get("id"))
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
def dropbox_verify(s, ctx):
|
|
347
|
+
return _who("https://api.dropboxapi.com/2/users/get_current_account", _bearer(s), lambda j: j.get("email"),
|
|
348
|
+
"POST")
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
def launchdarkly_verify(s, ctx):
|
|
352
|
+
return _who("https://app.launchdarkly.com/api/v2/caller-identity", {"Authorization": s},
|
|
353
|
+
lambda j: j.get("tokenName"))
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
def cloudflare_verify(s, ctx):
|
|
357
|
+
code, _, body = http("GET", "https://api.cloudflare.com/client/v4/user/tokens/verify", _bearer(s))
|
|
358
|
+
if code == 200:
|
|
359
|
+
status = (_json(body).get("result") or {}).get("status", "")
|
|
360
|
+
return Result(LIVE if status == "active" else DEAD, note=f"token status: {status}")
|
|
361
|
+
return _by_status(code)
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
def mailchimp_verify(s, ctx):
|
|
365
|
+
dc = s.rsplit("-", 1)[-1]
|
|
366
|
+
if not re.fullmatch(r"us\d{1,2}", dc): # the data center picks the host, so it must look like one
|
|
367
|
+
return Result(UNKNOWN, note="no data center suffix (-usNN) in the key")
|
|
368
|
+
auth = base64.b64encode(f"leakkill:{s}".encode()).decode()
|
|
369
|
+
return _who(f"https://{dc}.api.mailchimp.com/3.0/", {"Authorization": f"Basic {auth}"},
|
|
370
|
+
lambda j: j.get("account_name"))
|
|
371
|
+
|
|
372
|
+
|
|
281
373
|
@dataclass
|
|
282
374
|
class Provider:
|
|
283
375
|
verify: object = None
|
|
@@ -340,6 +432,27 @@ PROVIDERS = {
|
|
|
340
432
|
"service account: its admin console) and restrict network access to it."),
|
|
341
433
|
"Basic auth credentials": Provider(None, None, "The text after `Basic` is just base64 of user:password. Change "
|
|
342
434
|
"that user's password in the service it logs in to."),
|
|
435
|
+
"Postman key": Provider(postman_verify, None, "Delete it at https://go.postman.co/settings/me/api-keys."),
|
|
436
|
+
"Postman API token": Provider(postman_verify, None, "Delete it at https://go.postman.co/settings/me/api-keys."),
|
|
437
|
+
"Linear key": Provider(linear_verify, None, "Revoke it in Linear: Settings > Account > Security & access."),
|
|
438
|
+
"Linear API key": Provider(linear_verify, None, "Revoke it in Linear: Settings > Account > Security & access."),
|
|
439
|
+
"Notion API token": Provider(notion_verify, None, "Refresh the secret at https://www.notion.so/my-integrations."),
|
|
440
|
+
"Sentry user token": Provider(sentry_verify, None, "Revoke it at https://sentry.io/settings/account/api/auth-tokens/."),
|
|
441
|
+
"Sentry org token": Provider(sentry_verify, None, "Revoke it in Sentry: Settings > Developer Settings > Org Tokens."),
|
|
442
|
+
"Netlify access token": Provider(netlify_verify, None,
|
|
443
|
+
"Revoke it at https://app.netlify.com/user/applications#personal-access-tokens."),
|
|
444
|
+
"Doppler API token": Provider(doppler_verify, None, "Revoke it in Doppler: Settings > Tokens / Access."),
|
|
445
|
+
"Pulumi API token": Provider(pulumi_verify, None, "Delete it at https://app.pulumi.com/account/tokens."),
|
|
446
|
+
"Heroku API key v2": Provider(heroku_verify, None, "Revoke it with `heroku authorizations:revoke` or in Account settings."),
|
|
447
|
+
"Heroku API key": Provider(heroku_verify, None, "Regenerate it in Heroku: Account settings > API Key."),
|
|
448
|
+
"Sendinblue API token": Provider(brevo_verify, None, "Delete it at https://app.brevo.com/settings/keys/api."),
|
|
449
|
+
"Square access token": Provider(square_verify, None, "Revoke or replace it in the Square Developer Dashboard."),
|
|
450
|
+
"Airtable API key": Provider(airtable_verify, None, "Delete it at https://airtable.com/create/tokens."),
|
|
451
|
+
"Dropbox API token": Provider(dropbox_verify, None, "Revoke the app's access at https://www.dropbox.com/account/connected_apps."),
|
|
452
|
+
"Launchdarkly access token": Provider(launchdarkly_verify, None,
|
|
453
|
+
"Delete it in LaunchDarkly: Organization settings > Authorization."),
|
|
454
|
+
"Cloudflare API key": Provider(cloudflare_verify, None, "Roll or delete it at https://dash.cloudflare.com/profile/api-tokens."),
|
|
455
|
+
"Mailchimp API key": Provider(mailchimp_verify, None, "Delete it in Mailchimp: Profile > Extras > API keys."),
|
|
343
456
|
"High-entropy secret": Provider(None, None, "Treat as compromised: rotate it with whoever issued it."),
|
|
344
457
|
}
|
|
345
458
|
|
|
@@ -61,7 +61,7 @@ def render(items, target, verified=True):
|
|
|
61
61
|
lines += [head, "", f"1. **Revoke / rotate:** {_action(it)}"]
|
|
62
62
|
if r and r.note:
|
|
63
63
|
lines[-1] += f" \n _Check result: {r.note}_"
|
|
64
|
-
logs = [f for f in it.findings if f.path.endswith(".jsonl")]
|
|
64
|
+
logs = [f for f in it.findings if f.path.endswith(".jsonl") or ".vscdb#" in f.path]
|
|
65
65
|
if logs: # an AI agent's session transcript / history (`leakkill --agents`)
|
|
66
66
|
lines += [f"2. **Delete the agent session file(s)** that hold it in plain text "
|
|
67
67
|
f"({', '.join('`' + f.path + '`' for f in logs[:3])}). It was also sent to the model "
|
|
@@ -139,8 +139,16 @@ def real_password(pw, context):
|
|
|
139
139
|
and not all(w.lower() in FAKE_PASSWORDS for w in words)
|
|
140
140
|
|
|
141
141
|
|
|
142
|
+
# Template variables written in ALL_CAPS (`MASTER_PASSWORD`, `RDS_ENDPOINT`), as in docs and deploy templates.
|
|
143
|
+
ENV_NAME = re.compile(r"[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+")
|
|
144
|
+
|
|
145
|
+
|
|
142
146
|
def real_url_password(url):
|
|
143
|
-
|
|
147
|
+
m = CRED_URL.match(url)
|
|
148
|
+
host = re.split(r"[:/?#]", m.group(3)[1:], maxsplit=1)[0]
|
|
149
|
+
if ENV_NAME.fullmatch(m.group(2)) or ENV_NAME.fullmatch(host):
|
|
150
|
+
return False
|
|
151
|
+
return real_password(m.group(2), url)
|
|
144
152
|
|
|
145
153
|
|
|
146
154
|
def real_basic_auth(b64):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: leakkill
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.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
|
|
@@ -52,6 +52,13 @@ pip install leakkill
|
|
|
52
52
|
Python 3.9+, no dependencies. Latest development version:
|
|
53
53
|
`pip install git+https://github.com/ayushanand27/leakkill`
|
|
54
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
|
+
|
|
55
62
|
## Commands
|
|
56
63
|
|
|
57
64
|
| Command | What it does | Network? |
|
|
@@ -78,7 +85,8 @@ below), `--exclude-tests` and `--json`.
|
|
|
78
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 |
|
|
79
86
|
| SendGrid (`SG.`) | ✅ scopes | ✅ the key deletes itself if it has API-key permissions |
|
|
80
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 |
|
|
81
|
-
|
|
|
88
|
+
| Postman, Linear, Notion, Sentry, Netlify, Doppler, Pulumi, Heroku, Brevo, Square, Airtable, Dropbox, LaunchDarkly, Cloudflare, Mailchimp | ✅ (account where the API returns it); live only on HTTP 200, dead only on 401 | ❌ you get the exact page to revoke it |
|
|
89
|
+
| Google API keys, Shopify, PyPI, Docker Hub, Twilio, Perplexity, Azure Storage, private keys, JWTs, credentials in URLs and Basic auth headers, generic high-entropy secrets | detected, not verified | step-by-step rotation guidance |
|
|
82
90
|
|
|
83
91
|
## How it compares
|
|
84
92
|
|
|
@@ -86,9 +94,9 @@ below), `--exclude-tests` and `--json`.
|
|
|
86
94
|
|---|---|---|---|---|---|---|
|
|
87
95
|
| License / price | MIT, free | Apache 2.0, free | MIT, free | MIT, free | AGPL, free | free for individuals, paid for teams |
|
|
88
96
|
| Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
|
|
89
|
-
| Install | `pip
|
|
97
|
+
| Install | `pip` (zero dependencies) or Docker | Rust binary | Go binary | Go binary | Go binary | CLI + account |
|
|
90
98
|
| Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
|
|
91
|
-
| Checks if a key is live | ✅
|
|
99
|
+
| Checks if a key is live | ✅ 32 services | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
|
|
92
100
|
| Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
|
|
93
101
|
| Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
|
|
94
102
|
| Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
|
|
@@ -139,7 +147,7 @@ End to end on Windows with real, throwaway credentials:
|
|
|
139
147
|
|
|
140
148
|
Against the real AWS, GitLab, Anthropic and npm APIs, invalid keys are correctly reported DEAD.
|
|
141
149
|
Providers not yet tested with a live key (OpenAI, OpenRouter, Groq, Replicate, DigitalOcean,
|
|
142
|
-
SendGrid, Telegram) are covered by tests using simulated API responses.
|
|
150
|
+
SendGrid, Telegram, and the 15 added in 0.7) are covered by tests using simulated API responses.
|
|
143
151
|
|
|
144
152
|
### Accuracy (independent dataset)
|
|
145
153
|
|
|
@@ -148,7 +156,7 @@ by the same script ([details and how to reproduce](benchmarks/README.md)):
|
|
|
148
156
|
|
|
149
157
|
| | precision | recall | F1 | without OpenSSL test vectors (P / R / F1) | passwords in URLs | HTTP Basic auth |
|
|
150
158
|
|---|---|---|---|---|---|---|
|
|
151
|
-
| **leakkill 0.6** | 0.
|
|
159
|
+
| **leakkill 0.6** | 0.825 | 0.510 | **0.630** | 0.922 / 0.300 / 0.453 | **182/209** | **601/601** |
|
|
152
160
|
| Betterleaks 1.9 | 0.712 | **0.562** | 0.628 | 0.585 / **0.379** / **0.460** | 96/209 | 10/601 |
|
|
153
161
|
| Gitleaks 8.28 | 0.860 | 0.453 | 0.594 | 0.910 / 0.218 / 0.351 | 0/209 | 0/601 |
|
|
154
162
|
| Kingfisher 2.9 (no validation) | **0.961** | 0.104 | 0.187 | **0.925** / 0.079 / 0.145 | 20/209 | 5/601 |
|
|
@@ -156,14 +164,14 @@ by the same script ([details and how to reproduce](benchmarks/README.md)):
|
|
|
156
164
|
|
|
157
165
|
Compare on the "without OpenSSL test vectors" column: those are public crypto test data, not leaks. There,
|
|
158
166
|
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.
|
|
167
|
+
raises far fewer false alarms (precision 0.922 vs 0.585). leakkill is far ahead on passwords in URLs and Basic
|
|
160
168
|
auth headers, because it decodes and checks them. The generic rules were tuned on this dataset, which flatters
|
|
161
169
|
leakkill somewhat; false alarms on four clean repositories (requests, flask, django, express) stayed at
|
|
162
170
|
1 / 2 / 3 / 0.
|
|
163
171
|
|
|
164
172
|
### How it's tested
|
|
165
173
|
|
|
166
|
-
-
|
|
174
|
+
- 154 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
|
|
167
175
|
- Property-based fuzz tests: the scanner never crashes on random input, never prints a raw secret, finds a
|
|
168
176
|
planted token in any surrounding text, and gives the same answer scanning a whole file or line by line.
|
|
169
177
|
(Fuzzing found two real bugs before release: a guard crash and a slow-input case, both fixed.)
|
|
@@ -237,12 +245,12 @@ API keys. A key you pasted into a chat, or a `.env` the agent read, stays on dis
|
|
|
237
245
|
model provider. `--agents` scans, on your machine only:
|
|
238
246
|
|
|
239
247
|
- 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
|
|
248
|
+
Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor and VS Code (Copilot Chat) chat histories, Cursor, Windsurf, Claude Desktop and VS Code MCP configs
|
|
241
249
|
- this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
|
|
242
250
|
|
|
243
251
|
Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
|
|
244
252
|
login files (`~/.codex/auth.json`, `~/.claude/.credentials.json`, Gemini's OAuth file) are skipped, since that is
|
|
245
|
-
where their tokens belong. Cursor
|
|
253
|
+
where their tokens belong. Cursor and VS Code keep chats in SQLite databases (`state.vscdb`); they are opened read-only, so a running editor is never disturbed.
|
|
246
254
|
|
|
247
255
|
## Use in CI (GitHub Action)
|
|
248
256
|
|
|
@@ -315,7 +323,7 @@ baseline doesn't make it safe: revoke real keys first.
|
|
|
315
323
|
# .pre-commit-config.yaml
|
|
316
324
|
repos:
|
|
317
325
|
- repo: https://github.com/ayushanand27/leakkill
|
|
318
|
-
rev: v0.
|
|
326
|
+
rev: v0.7.0
|
|
319
327
|
hooks:
|
|
320
328
|
- id: leakkill
|
|
321
329
|
```
|
|
@@ -337,7 +345,6 @@ Or without the framework: `leakkill install-hook`.
|
|
|
337
345
|
- The agent guard is pattern-based: a command that builds a file name at runtime can get past it. The Cursor,
|
|
338
346
|
Copilot and Codex guards are tested against their documented hook formats; only Claude Code was tested in the
|
|
339
347
|
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.
|
|
341
348
|
- On very large repositories (tens of MB) scanning is about 2x slower than Gitleaks.
|
|
342
349
|
- Verification behind a proxy that injects its own credentials (some corporate and sandbox proxies
|
|
343
350
|
do) can report the proxy's identity. Run `verify` from a normal network.
|
|
@@ -86,3 +86,24 @@ def test_report_says_delete_session_file(tmp_path):
|
|
|
86
86
|
fs = agents.scan_agents(str(fake_home(tmp_path)), str(tmp_path), env={}, quiet=True)
|
|
87
87
|
items = [Item(1, f.kind, f.secret, [f]) for f in fs if f.kind == "Slack token"]
|
|
88
88
|
assert "Delete the agent session file" in report.render(items, "AI agent files", verified=False)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def test_cursor_and_vscode_chat_databases(tmp_path):
|
|
92
|
+
import sqlite3
|
|
93
|
+
home = tmp_path / "h"
|
|
94
|
+
ws = home / ".config" / "Cursor" / "User" / "workspaceStorage" / "abc"
|
|
95
|
+
ws.mkdir(parents=True)
|
|
96
|
+
con = sqlite3.connect(ws / "state.vscdb")
|
|
97
|
+
con.execute("CREATE TABLE ItemTable (key TEXT, value BLOB)")
|
|
98
|
+
con.execute("CREATE TABLE cursorDiskKV (key TEXT, value BLOB)")
|
|
99
|
+
con.execute("INSERT INTO ItemTable VALUES ('x', 'nothing here')")
|
|
100
|
+
con.execute("INSERT INTO cursorDiskKV VALUES ('bubbleId:1', ?)", (json.dumps({"text": f"my token {GH}"}).encode(),))
|
|
101
|
+
con.commit(); con.close()
|
|
102
|
+
vs = home / ".config" / "Code" / "User" / "globalStorage"
|
|
103
|
+
vs.mkdir(parents=True)
|
|
104
|
+
(vs / "state.vscdb").write_bytes(b"not a database") # corrupt: skipped, never crashes
|
|
105
|
+
assert [a for a, _ in agents.editor_dbs(str(home), env={})] == ["Cursor", "VS Code"]
|
|
106
|
+
fs = agents.scan_agents(str(home), str(tmp_path), env={}, quiet=True)
|
|
107
|
+
hits = [(f.kind, f.path) for f in fs]
|
|
108
|
+
assert ("GitHub token", os.path.join("~", ".config", "Cursor", "User", "workspaceStorage", "abc", "state.vscdb")
|
|
109
|
+
+ "#cursorDiskKV") in hits
|
|
@@ -102,8 +102,8 @@ def test_aws_temporary_and_mismatched_keys(monkeypatch):
|
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
def test_imported_kinds_get_generic_guidance():
|
|
105
|
-
assert P.verify("
|
|
106
|
-
ok, msg = P.revoke("
|
|
105
|
+
assert P.verify("Okta access token", "00okta").status == P.UNSUPPORTED
|
|
106
|
+
ok, msg = P.revoke("Okta access token", "00okta", P.Result(P.LIVE))
|
|
107
107
|
assert not ok and "dashboard" in msg
|
|
108
108
|
|
|
109
109
|
|
|
@@ -174,3 +174,45 @@ def test_every_detector_has_remediation():
|
|
|
174
174
|
from leakkill.scanner import RULES
|
|
175
175
|
for kind in list(RULES) + ["High-entropy secret"]:
|
|
176
176
|
assert P.PROVIDERS[kind].manual, kind
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
NEW = [ # kind, method, url, body that names the account, expected identity
|
|
180
|
+
("Postman API token", "GET", "https://api.getpostman.com/me", {"user": {"username": "ayu"}}, "ayu"),
|
|
181
|
+
("Linear API key", "POST", "https://api.linear.app/graphql", {"data": {"viewer": {"email": "a@x.io"}}}, "a@x.io"),
|
|
182
|
+
("Notion API token", "GET", "https://api.notion.com/v1/users/me", {"name": "bot"}, "bot"),
|
|
183
|
+
("Sentry user token", "GET", "https://sentry.io/api/0/", {"user": {"email": "s@x.io"}}, "s@x.io"),
|
|
184
|
+
("Netlify access token", "GET", "https://api.netlify.com/api/v1/user", {"email": "n@x.io"}, "n@x.io"),
|
|
185
|
+
("Doppler API token", "GET", "https://api.doppler.com/v3/me", {"workplace": {"name": "acme"}}, "acme"),
|
|
186
|
+
("Pulumi API token", "GET", "https://api.pulumi.com/api/user", {"githubLogin": "pl"}, "pl"),
|
|
187
|
+
("Heroku API key v2", "GET", "https://api.heroku.com/account", {"email": "h@x.io"}, "h@x.io"),
|
|
188
|
+
("Sendinblue API token", "GET", "https://api.brevo.com/v3/account", {"email": "b@x.io"}, "b@x.io"),
|
|
189
|
+
("Square access token", "GET", "https://connect.squareup.com/v2/merchants/me", {"merchant": {"business_name": "Shop"}}, "Shop"),
|
|
190
|
+
("Airtable API key", "GET", "https://api.airtable.com/v0/meta/whoami", {"id": "usr1"}, "usr1"),
|
|
191
|
+
("Dropbox API token", "POST", "https://api.dropboxapi.com/2/users/get_current_account", {"email": "d@x.io"}, "d@x.io"),
|
|
192
|
+
("Launchdarkly access token", "GET", "https://app.launchdarkly.com/api/v2/caller-identity", {"tokenName": "ci"}, "ci"),
|
|
193
|
+
("Mailchimp API key", "GET", "https://us6.api.mailchimp.com/3.0/", {"account_name": "Acme"}, "Acme"),
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
@pytest.mark.parametrize("kind,method,url,body,who", NEW)
|
|
198
|
+
def test_new_providers_live_dead_unknown(fake, kind, method, url, body, who):
|
|
199
|
+
key = "k" * 30 + "-us6"
|
|
200
|
+
fake({(method, url): (200, {}, json.dumps(body).encode())})
|
|
201
|
+
r = P.verify(kind, key)
|
|
202
|
+
assert r.status == P.LIVE and r.identity == who
|
|
203
|
+
fake({(method, url): (401, {}, b"")})
|
|
204
|
+
assert P.verify(kind, key).status == P.DEAD
|
|
205
|
+
fake({(method, url): (403, {}, b"")}) # anything but 401 is never called DEAD
|
|
206
|
+
assert P.verify(kind, key).status == P.UNKNOWN
|
|
207
|
+
fake({(method, url): (200, {}, b"not json")})
|
|
208
|
+
assert P.verify(kind, key).status == P.LIVE # odd body: still live, just no identity
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
def test_cloudflare_and_mailchimp_edges(fake):
|
|
212
|
+
url = "https://api.cloudflare.com/client/v4/user/tokens/verify"
|
|
213
|
+
fake({("GET", url): (200, {}, b'{"result": {"status": "active"}}')})
|
|
214
|
+
assert P.verify("Cloudflare API key", "c" * 40).status == P.LIVE
|
|
215
|
+
fake({("GET", url): (200, {}, b'{"result": {"status": "disabled"}}')})
|
|
216
|
+
assert P.verify("Cloudflare API key", "c" * 40).status == P.DEAD
|
|
217
|
+
f = fake({}) # a key without a -usNN suffix never picks a host
|
|
218
|
+
assert P.verify("Mailchimp API key", "m" * 32 + "-evil.example.com").status == P.UNKNOWN and not f.calls
|
|
@@ -184,3 +184,10 @@ def test_basic_auth_password_with_url_characters():
|
|
|
184
184
|
import base64
|
|
185
185
|
b64 = base64.b64encode(b"svc:p@ss/w0rd Zq81").decode()
|
|
186
186
|
assert kinds(f"Authorization: Basic {b64}") == ["Basic auth credentials"]
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def test_url_with_all_caps_template_parts_ignored():
|
|
190
|
+
for line in ["postgresql+asyncpg://MASTER_USER:MASTER_PASSWORD@RDS_ENDPOINT:5432/db",
|
|
191
|
+
"postgres://app:Sup3rS3cret9@DB_HOST:5432/app", "mysql://root:DB_PASSWORD@db.internal/app"]:
|
|
192
|
+
assert not kinds(line), line
|
|
193
|
+
assert kinds("postgres://app:SUP3RSECRET9@db.prod.internal/app") == ["Credentials in URL"] # caps, but no _
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|