leakkill 0.8.0__tar.gz → 0.8.2__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.8.0/src/leakkill.egg-info → leakkill-0.8.2}/PKG-INFO +16 -10
- {leakkill-0.8.0 → leakkill-0.8.2}/README.md +14 -8
- {leakkill-0.8.0 → leakkill-0.8.2}/pyproject.toml +1 -1
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/__init__.py +1 -1
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/agents.py +23 -5
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/cli.py +1 -1
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/onboard.py +1 -1
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/providers.py +18 -2
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/remote.py +1 -1
- {leakkill-0.8.0 → leakkill-0.8.2/src/leakkill.egg-info}/PKG-INFO +16 -10
- {leakkill-0.8.0 → leakkill-0.8.2}/tests/test_agents.py +38 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/tests/test_providers.py +18 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/tests/test_real_world.py +11 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/LICENSE +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/THIRD_PARTY_NOTICES.md +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/setup.cfg +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/__main__.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/aws.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/baseline.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/gitleaks_rules.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/guard.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/report.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/sarif.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill/scanner.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill.egg-info/SOURCES.txt +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill.egg-info/dependency_links.txt +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill.egg-info/entry_points.txt +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/src/leakkill.egg-info/top_level.txt +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/tests/test_cli.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/tests/test_coverage_gaps.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/tests/test_fuzz.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/tests/test_guard.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/tests/test_guard_agents.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/tests/test_import_gitleaks.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/tests/test_onboard_remote.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/tests/test_redos.py +0 -0
- {leakkill-0.8.0 → leakkill-0.8.2}/tests/test_scanner.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: leakkill
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.2
|
|
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
|
-
Author
|
|
5
|
+
Author: Ayush Anand
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/ayushanand27/leakkill
|
|
8
8
|
Project-URL: Documentation, https://github.com/ayushanand27/leakkill/tree/main/docs
|
|
@@ -35,12 +35,18 @@ Dynamic: license-file
|
|
|
35
35
|
|
|
36
36
|
[](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)
|
|
37
37
|
|
|
38
|
-
**
|
|
38
|
+
**Your AI coding agent has probably saved your API keys in plain text. Find them with one command, then check which are still live and revoke them. Free, local, zero dependencies.**
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
```sh
|
|
41
|
+
uvx leakkill scan --agents # nothing to install: what Claude Code, Cursor, Copilot, Codex and Gemini CLI kept on this machine
|
|
42
|
+
uvx leakkill scan # ...and the secrets in this folder (git-ignored files such as .env are skipped: add --include-ignored)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
A key you paste into a chat, or a `.env` the agent reads, stays on disk in its session history. leakkill finds
|
|
46
|
+
those, and the ones in your code and git history. `leakkill verify` and `leakkill revoke` then answer what comes next: is this key still working, whose
|
|
47
|
+
account is it, how do I revoke it right now, and how do I clean it out of git history? It can also
|
|
48
|
+
[stop agents reading or writing secrets](#ai-coding-agent-guard) in the first place. Everything runs on your
|
|
49
|
+
machine; nothing is uploaded.
|
|
44
50
|
|
|
45
51
|

|
|
46
52
|
|
|
@@ -117,7 +123,7 @@ below), `--exclude-tests` and `--json`.
|
|
|
117
123
|
| Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
|
|
118
124
|
| Install | `pip` (zero dependencies) or Docker | Rust binary | Go binary | Go binary | Go binary | CLI + account |
|
|
119
125
|
| Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
|
|
120
|
-
| Checks if a key is live | ✅
|
|
126
|
+
| Checks if a key is live | ✅ 33 services | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
|
|
121
127
|
| Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
|
|
122
128
|
| Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
|
|
123
129
|
| Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
|
|
@@ -268,7 +274,7 @@ API keys. A key you pasted into a chat, or a `.env` the agent read, stays on dis
|
|
|
268
274
|
model provider. `--agents` scans, on your machine only:
|
|
269
275
|
|
|
270
276
|
- Claude Code (`~/.claude.json`, `~/.claude/` including session transcripts), Codex (`~/.codex/`), GitHub
|
|
271
|
-
Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor and VS Code (Copilot Chat) chat histories, Cursor, Windsurf, Claude Desktop and VS Code MCP configs
|
|
277
|
+
Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor, Windsurf and VS Code (Copilot Chat) chat histories, Continue (`~/.continue/`), Cline and Roo Code task histories, Zed conversations and settings, Cursor, Windsurf, Claude Desktop and VS Code MCP configs
|
|
272
278
|
- this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
|
|
273
279
|
|
|
274
280
|
Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
|
|
@@ -346,7 +352,7 @@ baseline doesn't make it safe: revoke real keys first.
|
|
|
346
352
|
# .pre-commit-config.yaml
|
|
347
353
|
repos:
|
|
348
354
|
- repo: https://github.com/ayushanand27/leakkill
|
|
349
|
-
rev: v0.8.
|
|
355
|
+
rev: v0.8.2
|
|
350
356
|
hooks:
|
|
351
357
|
- id: leakkill
|
|
352
358
|
```
|
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
|
|
3
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
|
+
**Your AI coding agent has probably saved your API keys in plain text. Find them with one command, then check which are still live and revoke them. Free, local, zero dependencies.**
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
```sh
|
|
8
|
+
uvx leakkill scan --agents # nothing to install: what Claude Code, Cursor, Copilot, Codex and Gemini CLI kept on this machine
|
|
9
|
+
uvx leakkill scan # ...and the secrets in this folder (git-ignored files such as .env are skipped: add --include-ignored)
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
A key you paste into a chat, or a `.env` the agent reads, stays on disk in its session history. leakkill finds
|
|
13
|
+
those, and the ones in your code and git history. `leakkill verify` and `leakkill revoke` then answer what comes next: is this key still working, whose
|
|
14
|
+
account is it, how do I revoke it right now, and how do I clean it out of git history? It can also
|
|
15
|
+
[stop agents reading or writing secrets](#ai-coding-agent-guard) in the first place. Everything runs on your
|
|
16
|
+
machine; nothing is uploaded.
|
|
11
17
|
|
|
12
18
|

|
|
13
19
|
|
|
@@ -84,7 +90,7 @@ below), `--exclude-tests` and `--json`.
|
|
|
84
90
|
| Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
|
|
85
91
|
| Install | `pip` (zero dependencies) or Docker | Rust binary | Go binary | Go binary | Go binary | CLI + account |
|
|
86
92
|
| Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
|
|
87
|
-
| Checks if a key is live | ✅
|
|
93
|
+
| Checks if a key is live | ✅ 33 services | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
|
|
88
94
|
| Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
|
|
89
95
|
| Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
|
|
90
96
|
| Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
|
|
@@ -235,7 +241,7 @@ API keys. A key you pasted into a chat, or a `.env` the agent read, stays on dis
|
|
|
235
241
|
model provider. `--agents` scans, on your machine only:
|
|
236
242
|
|
|
237
243
|
- Claude Code (`~/.claude.json`, `~/.claude/` including session transcripts), Codex (`~/.codex/`), GitHub
|
|
238
|
-
Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor and VS Code (Copilot Chat) chat histories, Cursor, Windsurf, Claude Desktop and VS Code MCP configs
|
|
244
|
+
Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor, Windsurf and VS Code (Copilot Chat) chat histories, Continue (`~/.continue/`), Cline and Roo Code task histories, Zed conversations and settings, Cursor, Windsurf, Claude Desktop and VS Code MCP configs
|
|
239
245
|
- this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
|
|
240
246
|
|
|
241
247
|
Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
|
|
@@ -313,7 +319,7 @@ baseline doesn't make it safe: revoke real keys first.
|
|
|
313
319
|
# .pre-commit-config.yaml
|
|
314
320
|
repos:
|
|
315
321
|
- repo: https://github.com/ayushanand27/leakkill
|
|
316
|
-
rev: v0.8.
|
|
322
|
+
rev: v0.8.2
|
|
317
323
|
hooks:
|
|
318
324
|
- id: leakkill
|
|
319
325
|
```
|
|
@@ -10,7 +10,7 @@ readme = "README.md"
|
|
|
10
10
|
license = "MIT"
|
|
11
11
|
license-files = ["LICENSE", "THIRD_PARTY_NOTICES.md"]
|
|
12
12
|
requires-python = ">=3.9"
|
|
13
|
-
authors = [{ name = "Ayush
|
|
13
|
+
authors = [{ name = "Ayush Anand" }]
|
|
14
14
|
keywords = ["secrets", "secret-scanning", "secret-detection", "api-keys", "leaked-credentials", "credentials",
|
|
15
15
|
"security", "devsecops", "appsec", "pre-commit", "git-secrets", "gitleaks", "trufflehog", "sarif",
|
|
16
16
|
"revoke", "ai-agents", "claude-code", "cursor", "copilot", "codex", "mcp", "llm-security"]
|
|
@@ -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.8.
|
|
2
|
+
__version__ = "0.8.2"
|
|
@@ -20,24 +20,40 @@ HOME_PLACES = [
|
|
|
20
20
|
("Claude Desktop", "Library/Application Support/Claude/claude_desktop_config.json", False),
|
|
21
21
|
("VS Code", ".config/Code/User/mcp.json", False),
|
|
22
22
|
("VS Code", "Library/Application Support/Code/User/mcp.json", False),
|
|
23
|
+
("Continue", ".continue", True),
|
|
24
|
+
("Zed", ".config/zed/settings.json", False),
|
|
25
|
+
("Zed", ".local/share/zed/conversations", True),
|
|
26
|
+
("Zed", "Library/Application Support/Zed/conversations", True),
|
|
23
27
|
]
|
|
24
|
-
APPDATA_PLACES = [("Claude Desktop", "Claude/claude_desktop_config.json"), ("VS Code", "Code/User/mcp.json")
|
|
28
|
+
APPDATA_PLACES = [("Claude Desktop", "Claude/claude_desktop_config.json"), ("VS Code", "Code/User/mcp.json"),
|
|
29
|
+
("Zed", "Zed/settings.json")]
|
|
25
30
|
PROJECT_PLACES = [".mcp.json", ".cursor/mcp.json", ".vscode/mcp.json", ".claude/settings.json",
|
|
26
31
|
".claude/settings.local.json", ".gemini/settings.json", ".codex/config.toml"]
|
|
27
32
|
ENV_HOMES = {"CLAUDE_CONFIG_DIR": "Claude Code", "CODEX_HOME": "Codex", "COPILOT_HOME": "GitHub Copilot CLI"}
|
|
28
33
|
# The agent's own login (expected to hold a token), and bulky caches/third-party code that isn't the user's.
|
|
29
34
|
SKIP_NAMES = {".credentials.json", "auth.json", "oauth_creds.json", "google_accounts.json", "plugins", "extensions",
|
|
30
|
-
"node_modules", "pkg", "statsig", "ide", ".git", "cache", "Cache"}
|
|
31
|
-
TEXT_EXT = {".json", ".jsonl", ".toml", ".yaml", ".yml", ".md", ".txt", ".log", ".env", ".sh", ".ini", ".cfg", ""}
|
|
35
|
+
"node_modules", "pkg", "statsig", "ide", ".git", "cache", "Cache", "checkpoints"}
|
|
36
|
+
TEXT_EXT = {".json", ".jsonl", ".toml", ".yaml", ".yml", ".md", ".txt", ".log", ".env", ".sh", ".ini", ".cfg", ".zed", ""}
|
|
32
37
|
# Cursor and VS Code (Copilot Chat) keep chats in SQLite databases (state.vscdb) under the editor's user folder.
|
|
33
38
|
EDITOR_DIRS = {"Cursor": ["Library/Application Support/Cursor/User", ".config/Cursor/User"],
|
|
34
|
-
"VS Code": ["Library/Application Support/Code/User", ".config/Code/User"]
|
|
35
|
-
|
|
39
|
+
"VS Code": ["Library/Application Support/Code/User", ".config/Code/User"],
|
|
40
|
+
"Windsurf": ["Library/Application Support/Windsurf/User", ".config/Windsurf/User"]}
|
|
41
|
+
EDITOR_APPDATA = {"Cursor": "Cursor/User", "VS Code": "Code/User", "Windsurf": "Windsurf/User"}
|
|
42
|
+
# Extensions that keep whole task histories as files in the editor's globalStorage (any editor above can host them).
|
|
43
|
+
EXTENSION_DIRS = {"Cline": "saoudrizwan.claude-dev", "Roo Code": "rooveterinaryinc.roo-cline"}
|
|
36
44
|
DB_TABLES = ("ItemTable", "cursorDiskKV") # key/value tables; chats are JSON values
|
|
37
45
|
MAX_FILE = 500_000_000
|
|
38
46
|
CHUNK = 1_000_000
|
|
39
47
|
|
|
40
48
|
|
|
49
|
+
def _editor_roots(home, env):
|
|
50
|
+
"""User folders of the editors that keep chat state: [path]."""
|
|
51
|
+
roots = [os.path.join(home, d) for ds in EDITOR_DIRS.values() for d in ds]
|
|
52
|
+
if env.get("APPDATA"):
|
|
53
|
+
roots += [os.path.join(env["APPDATA"], d) for d in EDITOR_APPDATA.values()]
|
|
54
|
+
return roots
|
|
55
|
+
|
|
56
|
+
|
|
41
57
|
def places(home=None, cwd=None, env=None):
|
|
42
58
|
"""[(agent, path)] that exist on this machine."""
|
|
43
59
|
home = home or os.path.expanduser("~")
|
|
@@ -47,6 +63,8 @@ def places(home=None, cwd=None, env=None):
|
|
|
47
63
|
if env.get("APPDATA"):
|
|
48
64
|
out += [(a, os.path.join(env["APPDATA"], p)) for a, p in APPDATA_PLACES]
|
|
49
65
|
out += [(a, env[k]) for k, a in ENV_HOMES.items() if env.get(k)]
|
|
66
|
+
out += [(a, os.path.join(root, "globalStorage", ext)) for root in _editor_roots(home, env)
|
|
67
|
+
for a, ext in EXTENSION_DIRS.items()]
|
|
50
68
|
out += [("this project", os.path.join(cwd, p)) for p in PROJECT_PLACES]
|
|
51
69
|
seen, found = set(), []
|
|
52
70
|
for agent, p in out:
|
|
@@ -197,7 +197,7 @@ def cmd_revoke(args):
|
|
|
197
197
|
print(f" note for #{i.n} {i.kind}: {providers.provider(i.kind).side_effect}")
|
|
198
198
|
if not args.yes:
|
|
199
199
|
if auto:
|
|
200
|
-
print(
|
|
200
|
+
print("\nDry run. Re-run with --yes to revoke: " + ", ".join(f"#{i.n}" for i in auto))
|
|
201
201
|
return 1
|
|
202
202
|
failed = 0
|
|
203
203
|
for i in auto:
|
|
@@ -361,6 +361,22 @@ def cloudflare_verify(s, ctx):
|
|
|
361
361
|
return _by_status(code)
|
|
362
362
|
|
|
363
363
|
|
|
364
|
+
def mailgun_verify(s, ctx):
|
|
365
|
+
# Mailgun has two regions with separate hosts and a key only works on its own. A US-host 401 can therefore
|
|
366
|
+
# be an EU key, so a key is DEAD only when both hard-coded hosts answer 401.
|
|
367
|
+
auth = {"Authorization": "Basic " + base64.b64encode(f"api:{s}".encode()).decode()}
|
|
368
|
+
codes = []
|
|
369
|
+
for host in ("api.mailgun.net", "api.eu.mailgun.net"):
|
|
370
|
+
code, _, body = http("GET", f"https://{host}/v3/domains?limit=1", auth)
|
|
371
|
+
if code == 200:
|
|
372
|
+
n = _json(body).get("total_count")
|
|
373
|
+
return Result(LIVE, f"{n} domain(s)" if n is not None else "", "EU region" if "eu." in host else "")
|
|
374
|
+
codes.append(code)
|
|
375
|
+
if all(c == 401 for c in codes):
|
|
376
|
+
return Result(DEAD)
|
|
377
|
+
return Result(UNKNOWN, note=f"unexpected HTTP {codes[0]}/{codes[1]}")
|
|
378
|
+
|
|
379
|
+
|
|
364
380
|
def mailchimp_verify(s, ctx):
|
|
365
381
|
dc = s.rsplit("-", 1)[-1]
|
|
366
382
|
if not re.fullmatch(r"us\d{1,2}", dc): # the data center picks the host, so it must look like one
|
|
@@ -415,8 +431,6 @@ PROVIDERS = {
|
|
|
415
431
|
"PyPI token": Provider(None, None, "Remove it at https://pypi.org/manage/account/token/."),
|
|
416
432
|
"Docker Hub token": Provider(None, None, "Delete it in Docker Hub: Account settings > Personal access tokens."),
|
|
417
433
|
"Twilio API key": Provider(None, None, "Delete it in the Twilio console: Account > API keys & tokens."),
|
|
418
|
-
"Postman key": Provider(None, None, "Delete it in Postman: Settings > API keys."),
|
|
419
|
-
"Linear key": Provider(None, None, "Revoke it in Linear: Settings > Security & access > Personal API keys."),
|
|
420
434
|
"Azure storage key": Provider(None, None, "Rotate it in the Azure portal: Storage account > Security + networking > "
|
|
421
435
|
"Access keys > Rotate key."),
|
|
422
436
|
"Anthropic API key": Provider(anthropic_verify, None, "Delete it at https://console.anthropic.com/settings/keys."),
|
|
@@ -453,6 +467,8 @@ PROVIDERS = {
|
|
|
453
467
|
"Delete it in LaunchDarkly: Organization settings > Authorization."),
|
|
454
468
|
"Cloudflare API key": Provider(cloudflare_verify, None, "Roll or delete it at https://dash.cloudflare.com/profile/api-tokens."),
|
|
455
469
|
"Mailchimp API key": Provider(mailchimp_verify, None, "Delete it in Mailchimp: Profile > Extras > API keys."),
|
|
470
|
+
"Mailgun private API token": Provider(mailgun_verify, None,
|
|
471
|
+
"Regenerate it in Mailgun: Account security > API security > Private API key."),
|
|
456
472
|
"High-entropy secret": Provider(None, None, "Treat as compromised: rotate it with whoever issued it."),
|
|
457
473
|
}
|
|
458
474
|
|
|
@@ -7,7 +7,7 @@ For checking a repository before you trust it. Cloning untrusted code is the ris
|
|
|
7
7
|
hardening as every other leakkill git call (no repository-configured programs);
|
|
8
8
|
- the clone is deleted afterwards, even when the scan fails.
|
|
9
9
|
"""
|
|
10
|
-
import contextlib, os, re, shutil, stat,
|
|
10
|
+
import contextlib, os, re, shutil, stat, tempfile
|
|
11
11
|
|
|
12
12
|
URL = re.compile(r"^(?:https://[^\s/]+/\S+|ssh://\S+|[\w.-]+@[\w.-]+:\S+)$")
|
|
13
13
|
SHORT = re.compile(r"^(github\.com|gitlab\.com|bitbucket\.org|codeberg\.org)/[\w.-]+/[\w.-]+$")
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: leakkill
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.2
|
|
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
|
-
Author
|
|
5
|
+
Author: Ayush Anand
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/ayushanand27/leakkill
|
|
8
8
|
Project-URL: Documentation, https://github.com/ayushanand27/leakkill/tree/main/docs
|
|
@@ -35,12 +35,18 @@ Dynamic: license-file
|
|
|
35
35
|
|
|
36
36
|
[](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)
|
|
37
37
|
|
|
38
|
-
**
|
|
38
|
+
**Your AI coding agent has probably saved your API keys in plain text. Find them with one command, then check which are still live and revoke them. Free, local, zero dependencies.**
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
```sh
|
|
41
|
+
uvx leakkill scan --agents # nothing to install: what Claude Code, Cursor, Copilot, Codex and Gemini CLI kept on this machine
|
|
42
|
+
uvx leakkill scan # ...and the secrets in this folder (git-ignored files such as .env are skipped: add --include-ignored)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
A key you paste into a chat, or a `.env` the agent reads, stays on disk in its session history. leakkill finds
|
|
46
|
+
those, and the ones in your code and git history. `leakkill verify` and `leakkill revoke` then answer what comes next: is this key still working, whose
|
|
47
|
+
account is it, how do I revoke it right now, and how do I clean it out of git history? It can also
|
|
48
|
+
[stop agents reading or writing secrets](#ai-coding-agent-guard) in the first place. Everything runs on your
|
|
49
|
+
machine; nothing is uploaded.
|
|
44
50
|
|
|
45
51
|

|
|
46
52
|
|
|
@@ -117,7 +123,7 @@ below), `--exclude-tests` and `--json`.
|
|
|
117
123
|
| Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
|
|
118
124
|
| Install | `pip` (zero dependencies) or Docker | Rust binary | Go binary | Go binary | Go binary | CLI + account |
|
|
119
125
|
| Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
|
|
120
|
-
| Checks if a key is live | ✅
|
|
126
|
+
| Checks if a key is live | ✅ 33 services | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
|
|
121
127
|
| Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
|
|
122
128
|
| Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
|
|
123
129
|
| Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
|
|
@@ -268,7 +274,7 @@ API keys. A key you pasted into a chat, or a `.env` the agent read, stays on dis
|
|
|
268
274
|
model provider. `--agents` scans, on your machine only:
|
|
269
275
|
|
|
270
276
|
- Claude Code (`~/.claude.json`, `~/.claude/` including session transcripts), Codex (`~/.codex/`), GitHub
|
|
271
|
-
Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor and VS Code (Copilot Chat) chat histories, Cursor, Windsurf, Claude Desktop and VS Code MCP configs
|
|
277
|
+
Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor, Windsurf and VS Code (Copilot Chat) chat histories, Continue (`~/.continue/`), Cline and Roo Code task histories, Zed conversations and settings, Cursor, Windsurf, Claude Desktop and VS Code MCP configs
|
|
272
278
|
- this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
|
|
273
279
|
|
|
274
280
|
Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
|
|
@@ -346,7 +352,7 @@ baseline doesn't make it safe: revoke real keys first.
|
|
|
346
352
|
# .pre-commit-config.yaml
|
|
347
353
|
repos:
|
|
348
354
|
- repo: https://github.com/ayushanand27/leakkill
|
|
349
|
-
rev: v0.8.
|
|
355
|
+
rev: v0.8.2
|
|
350
356
|
hooks:
|
|
351
357
|
- id: leakkill
|
|
352
358
|
```
|
|
@@ -107,3 +107,41 @@ def test_cursor_and_vscode_chat_databases(tmp_path):
|
|
|
107
107
|
hits = [(f.kind, f.path) for f in fs]
|
|
108
108
|
assert ("GitHub token", os.path.join("~", ".config", "Cursor", "User", "workspaceStorage", "abc", "state.vscdb")
|
|
109
109
|
+ "#cursorDiskKV") in hits
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def test_more_agents_continue_cline_roo_zed_windsurf(tmp_path):
|
|
113
|
+
import sqlite3
|
|
114
|
+
home = tmp_path / "h"
|
|
115
|
+
|
|
116
|
+
def put(rel, text):
|
|
117
|
+
p = home / rel
|
|
118
|
+
p.parent.mkdir(parents=True, exist_ok=True)
|
|
119
|
+
p.write_text(text)
|
|
120
|
+
|
|
121
|
+
chat = json.dumps({"messages": [{"content": f"my token {GH}"}]})
|
|
122
|
+
put(".continue/sessions/s1.json", chat)
|
|
123
|
+
cline = ".config/Code/User/globalStorage/saoudrizwan.claude-dev"
|
|
124
|
+
put(cline + "/tasks/1/api_conversation_history.json", chat)
|
|
125
|
+
put(cline + "/checkpoints/big/blob.json", chat) # shadow-git copies of the user's files: skipped
|
|
126
|
+
put(".config/Cursor/User/globalStorage/rooveterinaryinc.roo-cline/tasks/2/ui_messages.json", chat)
|
|
127
|
+
put(".local/share/zed/conversations/c1.zed", chat)
|
|
128
|
+
put(".config/zed/settings.json", json.dumps({"context_servers": {"x": {"env": {"TOKEN": GH}}}}))
|
|
129
|
+
ws = home / ".config" / "Windsurf" / "User" / "globalStorage"
|
|
130
|
+
ws.mkdir(parents=True)
|
|
131
|
+
con = sqlite3.connect(ws / "state.vscdb")
|
|
132
|
+
con.execute("CREATE TABLE ItemTable (key TEXT, value BLOB)")
|
|
133
|
+
con.execute("INSERT INTO ItemTable VALUES ('chat', ?)", (chat.encode(),))
|
|
134
|
+
con.commit(); con.close()
|
|
135
|
+
|
|
136
|
+
found = {a for a, _ in agents.places(str(home), str(tmp_path), env={})}
|
|
137
|
+
assert {"Continue", "Cline", "Roo Code", "Zed"} <= found
|
|
138
|
+
assert [a for a, _ in agents.editor_dbs(str(home), env={})] == ["Windsurf"]
|
|
139
|
+
paths = {f.path for f in agents.scan_agents(str(home), str(tmp_path), env={}, quiet=True)
|
|
140
|
+
if f.kind == "GitHub token"}
|
|
141
|
+
sep = os.sep
|
|
142
|
+
for want in (".continue/sessions/s1.json", cline + "/tasks/1/api_conversation_history.json",
|
|
143
|
+
".config/Cursor/User/globalStorage/rooveterinaryinc.roo-cline/tasks/2/ui_messages.json",
|
|
144
|
+
".local/share/zed/conversations/c1.zed", ".config/zed/settings.json",
|
|
145
|
+
".config/Windsurf/User/globalStorage/state.vscdb#ItemTable"):
|
|
146
|
+
assert os.path.join("~", *want.split("/")) in paths, want
|
|
147
|
+
assert not any("checkpoints" in p for p in paths)
|
|
@@ -208,6 +208,24 @@ def test_new_providers_live_dead_unknown(fake, kind, method, url, body, who):
|
|
|
208
208
|
assert P.verify(kind, key).status == P.LIVE # odd body: still live, just no identity
|
|
209
209
|
|
|
210
210
|
|
|
211
|
+
def test_mailgun_checks_both_regions_and_needs_two_401s_for_dead(fake):
|
|
212
|
+
us, eu = "https://api.mailgun.net/v3/domains", "https://api.eu.mailgun.net/v3/domains"
|
|
213
|
+
key = "key-" + "a1" * 16
|
|
214
|
+
fake({("GET", us): (200, {}, b'{"total_count": 2}')})
|
|
215
|
+
r = P.verify("Mailgun private API token", key)
|
|
216
|
+
assert r.status == P.LIVE and r.identity == "2 domain(s)"
|
|
217
|
+
f = fake({("GET", us): (401, {}, b""), ("GET", eu): (200, {}, b'{"total_count": 1}')})
|
|
218
|
+
r = P.verify("Mailgun private API token", key) # an EU key is rejected by the US host but still live
|
|
219
|
+
assert r.status == P.LIVE and r.note == "EU region" and len(f.calls) == 2
|
|
220
|
+
assert f.calls[0][2]["Authorization"] == "Basic " + __import__("base64").b64encode(f"api:{key}".encode()).decode()
|
|
221
|
+
fake({("GET", us): (401, {}, b""), ("GET", eu): (401, {}, b"")})
|
|
222
|
+
assert P.verify("Mailgun private API token", key).status == P.DEAD
|
|
223
|
+
fake({("GET", us): (401, {}, b""), ("GET", eu): (403, {}, b"")}) # only 401 on both hosts may mean DEAD
|
|
224
|
+
assert P.verify("Mailgun private API token", key).status == P.UNKNOWN
|
|
225
|
+
fake({("GET", us): (200, {}, b"not json")})
|
|
226
|
+
assert P.verify("Mailgun private API token", key).status == P.LIVE
|
|
227
|
+
|
|
228
|
+
|
|
211
229
|
def test_cloudflare_and_mailchimp_edges(fake):
|
|
212
230
|
url = "https://api.cloudflare.com/client/v4/user/tokens/verify"
|
|
213
231
|
fake({("GET", url): (200, {}, b'{"result": {"status": "active"}}')})
|
|
@@ -152,3 +152,14 @@ def test_folder_names_that_look_like_options_are_just_folders(tmp_path, monkeypa
|
|
|
152
152
|
odd.mkdir()
|
|
153
153
|
(odd / "a.py").write_text(LINE)
|
|
154
154
|
assert [f.kind for f in scanner.scan_paths(["--upload-pack=evil"])] == ["GitHub token"]
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def test_dockerignore_keeps_what_the_fuzzer_image_copies():
|
|
158
|
+
"""The root .dockerignore (for the leakkill image) also applies to the ClusterFuzzLite build, which copies the
|
|
159
|
+
whole repository: excluding its inputs silently broke the weekly fuzzing in 0.6.1."""
|
|
160
|
+
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
161
|
+
allowed = {l[1:].strip() for l in open(os.path.join(root, ".dockerignore")) if l.startswith("!")}
|
|
162
|
+
needed = {"src/leakkill", ".clusterfuzzlite", "fuzz"}
|
|
163
|
+
assert needed <= allowed, f"add to .dockerignore: {sorted('!' + n for n in needed - allowed)}"
|
|
164
|
+
for n in needed:
|
|
165
|
+
assert os.path.exists(os.path.join(root, n)), n
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|