leakkill 0.6.1__tar.gz → 0.7.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. {leakkill-0.6.1/src/leakkill.egg-info → leakkill-0.7.1}/PKG-INFO +11 -9
  2. {leakkill-0.6.1 → leakkill-0.7.1}/README.md +10 -8
  3. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill/__init__.py +1 -1
  4. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill/agents.py +57 -3
  5. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill/cli.py +18 -0
  6. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill/providers.py +113 -0
  7. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill/report.py +1 -1
  8. {leakkill-0.6.1 → leakkill-0.7.1/src/leakkill.egg-info}/PKG-INFO +11 -9
  9. {leakkill-0.6.1 → leakkill-0.7.1}/tests/test_agents.py +21 -0
  10. {leakkill-0.6.1 → leakkill-0.7.1}/tests/test_cli.py +10 -0
  11. {leakkill-0.6.1 → leakkill-0.7.1}/tests/test_coverage_gaps.py +2 -2
  12. {leakkill-0.6.1 → leakkill-0.7.1}/tests/test_providers.py +42 -0
  13. {leakkill-0.6.1 → leakkill-0.7.1}/LICENSE +0 -0
  14. {leakkill-0.6.1 → leakkill-0.7.1}/THIRD_PARTY_NOTICES.md +0 -0
  15. {leakkill-0.6.1 → leakkill-0.7.1}/pyproject.toml +0 -0
  16. {leakkill-0.6.1 → leakkill-0.7.1}/setup.cfg +0 -0
  17. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill/__main__.py +0 -0
  18. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill/aws.py +0 -0
  19. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill/baseline.py +0 -0
  20. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill/gitleaks_rules.py +0 -0
  21. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill/guard.py +0 -0
  22. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill/sarif.py +0 -0
  23. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill/scanner.py +0 -0
  24. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill.egg-info/SOURCES.txt +0 -0
  25. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill.egg-info/dependency_links.txt +0 -0
  26. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill.egg-info/entry_points.txt +0 -0
  27. {leakkill-0.6.1 → leakkill-0.7.1}/src/leakkill.egg-info/top_level.txt +0 -0
  28. {leakkill-0.6.1 → leakkill-0.7.1}/tests/test_fuzz.py +0 -0
  29. {leakkill-0.6.1 → leakkill-0.7.1}/tests/test_guard.py +0 -0
  30. {leakkill-0.6.1 → leakkill-0.7.1}/tests/test_guard_agents.py +0 -0
  31. {leakkill-0.6.1 → leakkill-0.7.1}/tests/test_import_gitleaks.py +0 -0
  32. {leakkill-0.6.1 → leakkill-0.7.1}/tests/test_redos.py +0 -0
  33. {leakkill-0.6.1 → leakkill-0.7.1}/tests/test_scanner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: leakkill
3
- Version: 0.6.1
3
+ Version: 0.7.1
4
4
  Summary: Find leaked secrets, check if they're live, revoke them in one command, and keep them out of AI coding agents
5
5
  Author-email: Ayush <andymylove24@gmail.com>
6
6
  License-Expression: MIT
@@ -85,7 +85,8 @@ below), `--exclude-tests` and `--json`.
85
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 |
86
86
  | SendGrid (`SG.`) | ✅ scopes | ✅ the key deletes itself if it has API-key permissions |
87
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 |
88
- | Google API keys, Shopify, PyPI, Docker Hub, Twilio, Postman, Perplexity, Linear, Azure Storage, private keys, JWTs, credentials in URLs and Basic auth headers, generic high-entropy secrets | detected, not verified | step-by-step rotation guidance |
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 |
89
90
 
90
91
  ## How it compares
91
92
 
@@ -95,7 +96,7 @@ below), `--exclude-tests` and `--json`.
95
96
  | Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
96
97
  | Install | `pip` (zero dependencies) or Docker | Rust binary | Go binary | Go binary | Go binary | CLI + account |
97
98
  | Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
98
- | Checks if a key is live | ✅ 17 providers | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
99
+ | Checks if a key is live | ✅ 32 services | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
99
100
  | Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
100
101
  | Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
101
102
  | Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
@@ -143,10 +144,12 @@ End to end on Windows with real, throwaway credentials:
143
144
  | Slack webhook | LIVE | (died with the app) | DEAD |
144
145
  | Stripe test key | LIVE, correct account, "test mode" | manual roll in dashboard | |
145
146
  | Hugging Face token | LIVE, correct user and token role | manual delete | |
147
+ | Postman API key | LIVE, correct username | manual delete (page linked) | DEAD |
148
+ | Netlify access token | LIVE, correct account email | manual delete (page linked) | DEAD |
146
149
 
147
150
  Against the real AWS, GitLab, Anthropic and npm APIs, invalid keys are correctly reported DEAD.
148
151
  Providers not yet tested with a live key (OpenAI, OpenRouter, Groq, Replicate, DigitalOcean,
149
- SendGrid, Telegram) are covered by tests using simulated API responses.
152
+ SendGrid, Telegram, and the other 13 added in 0.7) are covered by tests using simulated API responses.
150
153
 
151
154
  ### Accuracy (independent dataset)
152
155
 
@@ -170,7 +173,7 @@ leakkill somewhat; false alarms on four clean repositories (requests, flask, dja
170
173
 
171
174
  ### How it's tested
172
175
 
173
- - 137 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
176
+ - 155 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
174
177
  - Property-based fuzz tests: the scanner never crashes on random input, never prints a raw secret, finds a
175
178
  planted token in any surrounding text, and gives the same answer scanning a whole file or line by line.
176
179
  (Fuzzing found two real bugs before release: a guard crash and a slow-input case, both fixed.)
@@ -244,12 +247,12 @@ API keys. A key you pasted into a chat, or a `.env` the agent read, stays on dis
244
247
  model provider. `--agents` scans, on your machine only:
245
248
 
246
249
  - Claude Code (`~/.claude.json`, `~/.claude/` including session transcripts), Codex (`~/.codex/`), GitHub
247
- Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor, Windsurf, Claude Desktop and VS Code MCP configs
250
+ Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor and VS Code (Copilot Chat) chat histories, Cursor, Windsurf, Claude Desktop and VS Code MCP configs
248
251
  - this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
249
252
 
250
253
  Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
251
254
  login files (`~/.codex/auth.json`, `~/.claude/.credentials.json`, Gemini's OAuth file) are skipped, since that is
252
- where their tokens belong. Cursor's chat history is stored in a database and is not scanned yet.
255
+ 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.
253
256
 
254
257
  ## Use in CI (GitHub Action)
255
258
 
@@ -322,7 +325,7 @@ baseline doesn't make it safe: revoke real keys first.
322
325
  # .pre-commit-config.yaml
323
326
  repos:
324
327
  - repo: https://github.com/ayushanand27/leakkill
325
- rev: v0.6.1
328
+ rev: v0.7.1
326
329
  hooks:
327
330
  - id: leakkill
328
331
  ```
@@ -344,7 +347,6 @@ Or without the framework: `leakkill install-hook`.
344
347
  - The agent guard is pattern-based: a command that builds a file name at runtime can get past it. The Cursor,
345
348
  Copilot and Codex guards are tested against their documented hook formats; only Claude Code was tested in the
346
349
  real app. Copilot ignores prompt hooks, so a key typed into a Copilot prompt is warned about, not blocked.
347
- - `--agents` doesn't read Cursor's chat history (a database), only its MCP config.
348
350
  - On very large repositories (tens of MB) scanning is about 2x slower than Gitleaks.
349
351
  - Verification behind a proxy that injects its own credentials (some corporate and sandbox proxies
350
352
  do) can report the proxy's identity. Run `verify` from a normal network.
@@ -65,7 +65,8 @@ below), `--exclude-tests` and `--json`.
65
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 |
66
66
  | SendGrid (`SG.`) | ✅ scopes | ✅ the key deletes itself if it has API-key permissions |
67
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 |
68
- | Google API keys, Shopify, PyPI, Docker Hub, Twilio, Postman, Perplexity, Linear, Azure Storage, private keys, JWTs, credentials in URLs and Basic auth headers, generic high-entropy secrets | detected, not verified | step-by-step rotation guidance |
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 |
69
70
 
70
71
  ## How it compares
71
72
 
@@ -75,7 +76,7 @@ below), `--exclude-tests` and `--json`.
75
76
  | Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
76
77
  | Install | `pip` (zero dependencies) or Docker | Rust binary | Go binary | Go binary | Go binary | CLI + account |
77
78
  | Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
78
- | Checks if a key is live | ✅ 17 providers | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
79
+ | Checks if a key is live | ✅ 32 services | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
79
80
  | Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
80
81
  | Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
81
82
  | Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
@@ -123,10 +124,12 @@ End to end on Windows with real, throwaway credentials:
123
124
  | Slack webhook | LIVE | (died with the app) | DEAD |
124
125
  | Stripe test key | LIVE, correct account, "test mode" | manual roll in dashboard | |
125
126
  | Hugging Face token | LIVE, correct user and token role | manual delete | |
127
+ | Postman API key | LIVE, correct username | manual delete (page linked) | DEAD |
128
+ | Netlify access token | LIVE, correct account email | manual delete (page linked) | DEAD |
126
129
 
127
130
  Against the real AWS, GitLab, Anthropic and npm APIs, invalid keys are correctly reported DEAD.
128
131
  Providers not yet tested with a live key (OpenAI, OpenRouter, Groq, Replicate, DigitalOcean,
129
- SendGrid, Telegram) are covered by tests using simulated API responses.
132
+ SendGrid, Telegram, and the other 13 added in 0.7) are covered by tests using simulated API responses.
130
133
 
131
134
  ### Accuracy (independent dataset)
132
135
 
@@ -150,7 +153,7 @@ leakkill somewhat; false alarms on four clean repositories (requests, flask, dja
150
153
 
151
154
  ### How it's tested
152
155
 
153
- - 137 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
156
+ - 155 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
154
157
  - Property-based fuzz tests: the scanner never crashes on random input, never prints a raw secret, finds a
155
158
  planted token in any surrounding text, and gives the same answer scanning a whole file or line by line.
156
159
  (Fuzzing found two real bugs before release: a guard crash and a slow-input case, both fixed.)
@@ -224,12 +227,12 @@ API keys. A key you pasted into a chat, or a `.env` the agent read, stays on dis
224
227
  model provider. `--agents` scans, on your machine only:
225
228
 
226
229
  - Claude Code (`~/.claude.json`, `~/.claude/` including session transcripts), Codex (`~/.codex/`), GitHub
227
- Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor, Windsurf, Claude Desktop and VS Code MCP configs
230
+ Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor and VS Code (Copilot Chat) chat histories, Cursor, Windsurf, Claude Desktop and VS Code MCP configs
228
231
  - this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
229
232
 
230
233
  Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
231
234
  login files (`~/.codex/auth.json`, `~/.claude/.credentials.json`, Gemini's OAuth file) are skipped, since that is
232
- where their tokens belong. Cursor's chat history is stored in a database and is not scanned yet.
235
+ 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.
233
236
 
234
237
  ## Use in CI (GitHub Action)
235
238
 
@@ -302,7 +305,7 @@ baseline doesn't make it safe: revoke real keys first.
302
305
  # .pre-commit-config.yaml
303
306
  repos:
304
307
  - repo: https://github.com/ayushanand27/leakkill
305
- rev: v0.6.1
308
+ rev: v0.7.1
306
309
  hooks:
307
310
  - id: leakkill
308
311
  ```
@@ -324,7 +327,6 @@ Or without the framework: `leakkill install-hook`.
324
327
  - The agent guard is pattern-based: a command that builds a file name at runtime can get past it. The Cursor,
325
328
  Copilot and Codex guards are tested against their documented hook formats; only Claude Code was tested in the
326
329
  real app. Copilot ignores prompt hooks, so a key typed into a Copilot prompt is warned about, not blocked.
327
- - `--agents` doesn't read Cursor's chat history (a database), only its MCP config.
328
330
  - On very large repositories (tens of MB) scanning is about 2x slower than Gitleaks.
329
331
  - Verification behind a proxy that injects its own credentials (some corporate and sandbox proxies
330
332
  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.6.1"
2
+ __version__ = "0.7.1"
@@ -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 "
@@ -106,6 +106,21 @@ def summary(items):
106
106
  return s + "."
107
107
 
108
108
 
109
+ def next_step(items, args, verified):
110
+ """One line telling a newcomer what to run next (text output only)."""
111
+ if not items:
112
+ return ""
113
+ flags = "".join(f" --{f}" for f in ("agents", "history", "staged") if getattr(args, f, False))
114
+ if not verified:
115
+ return (f"Next: `leakkill verify{flags}` checks which still work and whose they are. "
116
+ "False alarm? Add `leakkill:ignore` to that line.")
117
+ live = sum(1 for i in items if i.result and i.result.status == providers.LIVE)
118
+ if live:
119
+ return (f"Next: `leakkill revoke{flags}` shows how to kill the {live} live key(s) (add --yes to do it); "
120
+ f"`leakkill report{flags}` writes the cleanup steps.")
121
+ return f"None are live, but still remove them from the code: `leakkill report{flags}` lists the steps."
122
+
123
+
109
124
  def _target(args):
110
125
  return "AI agent files" if args.agents else "git history" if args.history else "staged changes" if args.staged else " ".join(args.paths or ["."])
111
126
 
@@ -124,6 +139,9 @@ def cmd_scan(args, verify=False):
124
139
  else:
125
140
  print_items(items)
126
141
  print(summary(items))
142
+ hint = next_step(items, args, verify)
143
+ if hint:
144
+ print(hint)
127
145
  if args.agents and items:
128
146
  print("\n" + agents.ADVICE)
129
147
  if args.report:
@@ -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 "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: leakkill
3
- Version: 0.6.1
3
+ Version: 0.7.1
4
4
  Summary: Find leaked secrets, check if they're live, revoke them in one command, and keep them out of AI coding agents
5
5
  Author-email: Ayush <andymylove24@gmail.com>
6
6
  License-Expression: MIT
@@ -85,7 +85,8 @@ below), `--exclude-tests` and `--json`.
85
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 |
86
86
  | SendGrid (`SG.`) | ✅ scopes | ✅ the key deletes itself if it has API-key permissions |
87
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 |
88
- | Google API keys, Shopify, PyPI, Docker Hub, Twilio, Postman, Perplexity, Linear, Azure Storage, private keys, JWTs, credentials in URLs and Basic auth headers, generic high-entropy secrets | detected, not verified | step-by-step rotation guidance |
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 |
89
90
 
90
91
  ## How it compares
91
92
 
@@ -95,7 +96,7 @@ below), `--exclude-tests` and `--json`.
95
96
  | Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
96
97
  | Install | `pip` (zero dependencies) or Docker | Rust binary | Go binary | Go binary | Go binary | CLI + account |
97
98
  | Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
98
- | Checks if a key is live | ✅ 17 providers | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
99
+ | Checks if a key is live | ✅ 32 services | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
99
100
  | Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
100
101
  | Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
101
102
  | Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
@@ -143,10 +144,12 @@ End to end on Windows with real, throwaway credentials:
143
144
  | Slack webhook | LIVE | (died with the app) | DEAD |
144
145
  | Stripe test key | LIVE, correct account, "test mode" | manual roll in dashboard | |
145
146
  | Hugging Face token | LIVE, correct user and token role | manual delete | |
147
+ | Postman API key | LIVE, correct username | manual delete (page linked) | DEAD |
148
+ | Netlify access token | LIVE, correct account email | manual delete (page linked) | DEAD |
146
149
 
147
150
  Against the real AWS, GitLab, Anthropic and npm APIs, invalid keys are correctly reported DEAD.
148
151
  Providers not yet tested with a live key (OpenAI, OpenRouter, Groq, Replicate, DigitalOcean,
149
- SendGrid, Telegram) are covered by tests using simulated API responses.
152
+ SendGrid, Telegram, and the other 13 added in 0.7) are covered by tests using simulated API responses.
150
153
 
151
154
  ### Accuracy (independent dataset)
152
155
 
@@ -170,7 +173,7 @@ leakkill somewhat; false alarms on four clean repositories (requests, flask, dja
170
173
 
171
174
  ### How it's tested
172
175
 
173
- - 137 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
176
+ - 155 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
174
177
  - Property-based fuzz tests: the scanner never crashes on random input, never prints a raw secret, finds a
175
178
  planted token in any surrounding text, and gives the same answer scanning a whole file or line by line.
176
179
  (Fuzzing found two real bugs before release: a guard crash and a slow-input case, both fixed.)
@@ -244,12 +247,12 @@ API keys. A key you pasted into a chat, or a `.env` the agent read, stays on dis
244
247
  model provider. `--agents` scans, on your machine only:
245
248
 
246
249
  - Claude Code (`~/.claude.json`, `~/.claude/` including session transcripts), Codex (`~/.codex/`), GitHub
247
- Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor, Windsurf, Claude Desktop and VS Code MCP configs
250
+ Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor and VS Code (Copilot Chat) chat histories, Cursor, Windsurf, Claude Desktop and VS Code MCP configs
248
251
  - this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
249
252
 
250
253
  Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
251
254
  login files (`~/.codex/auth.json`, `~/.claude/.credentials.json`, Gemini's OAuth file) are skipped, since that is
252
- where their tokens belong. Cursor's chat history is stored in a database and is not scanned yet.
255
+ 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.
253
256
 
254
257
  ## Use in CI (GitHub Action)
255
258
 
@@ -322,7 +325,7 @@ baseline doesn't make it safe: revoke real keys first.
322
325
  # .pre-commit-config.yaml
323
326
  repos:
324
327
  - repo: https://github.com/ayushanand27/leakkill
325
- rev: v0.6.1
328
+ rev: v0.7.1
326
329
  hooks:
327
330
  - id: leakkill
328
331
  ```
@@ -344,7 +347,6 @@ Or without the framework: `leakkill install-hook`.
344
347
  - The agent guard is pattern-based: a command that builds a file name at runtime can get past it. The Cursor,
345
348
  Copilot and Codex guards are tested against their documented hook formats; only Claude Code was tested in the
346
349
  real app. Copilot ignores prompt hooks, so a key typed into a Copilot prompt is warned about, not blocked.
347
- - `--agents` doesn't read Cursor's chat history (a database), only its MCP config.
348
350
  - On very large repositories (tens of MB) scanning is about 2x slower than Gitleaks.
349
351
  - Verification behind a proxy that injects its own credentials (some corporate and sandbox proxies
350
352
  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
@@ -131,3 +131,13 @@ def test_replacements_file_is_owner_only_and_never_overwrites(tmp_path, monkeypa
131
131
  (tmp_path / "keep.txt").write_text("important")
132
132
  assert cli.main(["report", "--replacements", "keep.txt"]) == 2
133
133
  assert (tmp_path / "keep.txt").read_text() == "important" and "not overwriting" in capsys.readouterr().err
134
+
135
+
136
+ def test_next_step_hints(tmp_path, monkeypatch, capsys):
137
+ project(tmp_path, monkeypatch); fake_verify(monkeypatch)
138
+ cli.main(["scan"])
139
+ assert "Next: `leakkill verify`" in capsys.readouterr().out
140
+ cli.main(["verify"])
141
+ assert "Next: `leakkill revoke`" in capsys.readouterr().out
142
+ cli.main(["scan", "--json"])
143
+ assert "Next:" not in capsys.readouterr().out # machine output stays pure JSON
@@ -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("Doppler API token", "dp.pt.x").status == P.UNSUPPORTED
106
- ok, msg = P.revoke("Doppler API token", "dp.pt.x", P.Result(P.LIVE))
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
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