leakkill 0.4.2__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- leakkill-0.6.0/PKG-INFO +347 -0
- leakkill-0.6.0/README.md +327 -0
- leakkill-0.6.0/THIRD_PARTY_NOTICES.md +29 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/pyproject.toml +10 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/src/leakkill/__init__.py +1 -1
- leakkill-0.6.0/src/leakkill/__main__.py +4 -0
- leakkill-0.6.0/src/leakkill/agents.py +146 -0
- leakkill-0.6.0/src/leakkill/baseline.py +37 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/src/leakkill/cli.py +65 -17
- leakkill-0.6.0/src/leakkill/gitleaks_rules.py +1941 -0
- leakkill-0.6.0/src/leakkill/guard.py +281 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/src/leakkill/providers.py +13 -3
- {leakkill-0.4.2 → leakkill-0.6.0}/src/leakkill/report.py +16 -10
- leakkill-0.6.0/src/leakkill/sarif.py +53 -0
- leakkill-0.6.0/src/leakkill/scanner.py +433 -0
- leakkill-0.6.0/src/leakkill.egg-info/PKG-INFO +347 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/src/leakkill.egg-info/SOURCES.txt +11 -0
- leakkill-0.6.0/tests/test_agents.py +88 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/tests/test_cli.py +42 -0
- leakkill-0.6.0/tests/test_coverage_gaps.py +118 -0
- leakkill-0.6.0/tests/test_fuzz.py +89 -0
- leakkill-0.6.0/tests/test_guard_agents.py +162 -0
- leakkill-0.6.0/tests/test_import_gitleaks.py +53 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/tests/test_providers.py +4 -2
- leakkill-0.6.0/tests/test_redos.py +37 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/tests/test_scanner.py +96 -0
- leakkill-0.4.2/PKG-INFO +0 -212
- leakkill-0.4.2/README.md +0 -193
- leakkill-0.4.2/src/leakkill/__main__.py +0 -3
- leakkill-0.4.2/src/leakkill/guard.py +0 -97
- leakkill-0.4.2/src/leakkill/scanner.py +0 -198
- leakkill-0.4.2/src/leakkill.egg-info/PKG-INFO +0 -212
- {leakkill-0.4.2 → leakkill-0.6.0}/LICENSE +0 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/setup.cfg +0 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/src/leakkill/aws.py +0 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/src/leakkill.egg-info/dependency_links.txt +0 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/src/leakkill.egg-info/entry_points.txt +0 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/src/leakkill.egg-info/top_level.txt +0 -0
- {leakkill-0.4.2 → leakkill-0.6.0}/tests/test_guard.py +0 -0
leakkill-0.6.0/PKG-INFO
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: leakkill
|
|
3
|
+
Version: 0.6.0
|
|
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-email: Ayush <andymylove24@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ayushanand27/leakkill
|
|
8
|
+
Project-URL: Issues, https://github.com/ayushanand27/leakkill/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/ayushanand27/leakkill/blob/main/CHANGELOG.md
|
|
10
|
+
Keywords: secrets,security,leak,revoke,pre-commit,claude-code,ai-agents,devsecops
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Topic :: Security
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
License-File: THIRD_PARTY_NOTICES.md
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# leakkill
|
|
22
|
+
|
|
23
|
+
[](https://pypi.org/project/leakkill/) [](https://github.com/ayushanand27/leakkill/actions/workflows/ci.yml) [](https://scorecard.dev/viewer/?uri=github.com/ayushanand27/leakkill) [](https://www.bestpractices.dev/projects/15151)
|
|
24
|
+
|
|
25
|
+
**Leaked a key? Find it, see if it's live, and kill it in one command. Free, local, zero dependencies.**
|
|
26
|
+
|
|
27
|
+
Most secret scanners stop at *finding* secrets. leakkill also answers what comes next: is this key still
|
|
28
|
+
working, whose account is it, how do I revoke it right now, and how do I clean it out of git history? It installs
|
|
29
|
+
with a plain `pip install` (no dependencies), runs locally, and can stop AI coding agents from reading or writing
|
|
30
|
+
secrets in the first place.
|
|
31
|
+
|
|
32
|
+
```console
|
|
33
|
+
$ leakkill verify
|
|
34
|
+
#1 LIVE GitHub token ghp_************ config.py:3
|
|
35
|
+
octocat scopes: repo, workflow
|
|
36
|
+
#2 DEAD AWS access key AKIA************ deploy/old.sh:12
|
|
37
|
+
key id is unknown or deactivated
|
|
38
|
+
#3 UNVERIFIABLE Credentials in URL postgres://app:****@db.prod.internal .env.backup:1
|
|
39
|
+
|
|
40
|
+
3 unique secret(s), 1 LIVE.
|
|
41
|
+
|
|
42
|
+
$ leakkill revoke --only 1 --yes
|
|
43
|
+
#1 GitHub token: REVOKED (HTTP 202)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
pip install leakkill
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Python 3.9+, no dependencies. Latest development version:
|
|
53
|
+
`pip install git+https://github.com/ayushanand27/leakkill`
|
|
54
|
+
|
|
55
|
+
## Commands
|
|
56
|
+
|
|
57
|
+
| Command | What it does | Network? |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `leakkill [scan] [PATH ...]` | Find secrets. Exit code 1 if any. | **Never** |
|
|
60
|
+
| `leakkill verify` | Also check each secret against the provider that issued it: live or dead, which account, which scopes | Read-only "who am I" calls |
|
|
61
|
+
| `leakkill revoke` | Show what can be revoked. With `--yes`, revoke the live ones (`--only 1,3` to pick) | Only with `--yes` |
|
|
62
|
+
| `leakkill report` | Write `leakkill-report.md`: every leak, its status and owner, and the cleanup steps in order | Same as `verify` (`--no-verify` to skip) |
|
|
63
|
+
| `leakkill install-hook` | Git pre-commit hook that blocks commits containing secrets | Never |
|
|
64
|
+
| `leakkill install-agent-hooks` | Stop AI coding agents (Claude Code, Cursor, GitHub Copilot, OpenAI Codex) reading `.env` and keys, sending secrets in prompts, or writing secrets into code | Never |
|
|
65
|
+
|
|
66
|
+
Every scan command also accepts `--staged` (pre-commit), `--history` (every commit on every branch,
|
|
67
|
+
including secrets you already "deleted"), `--agents` (secrets your AI coding agents stored on this machine, see
|
|
68
|
+
below), `--exclude-tests` and `--json`.
|
|
69
|
+
|
|
70
|
+
## What it can verify and revoke
|
|
71
|
+
|
|
72
|
+
| Provider | Verify (live? whose?) | Revoke from the CLI |
|
|
73
|
+
|---|---|---|
|
|
74
|
+
| GitHub (`ghp_`, `github_pat_`, `gho_`, `ghu_`, `ghr_`) | ✅ user and scopes | ✅ via GitHub's [credential revocation API](https://docs.github.com/en/rest/credentials/revoke) (the owner is notified) |
|
|
75
|
+
| GitLab (`glpat-`) | ✅ token name, scopes, expiry | ✅ self-revoke |
|
|
76
|
+
| Slack tokens (`xox…`) | ✅ user and workspace | ✅ `auth.revoke` |
|
|
77
|
+
| Discord webhooks | ✅ server and channel | ✅ deletes the webhook |
|
|
78
|
+
| AWS access key and secret | ✅ IAM ARN and account (STS, needs no permissions) | ⚠️ deactivates the key if it has `iam:UpdateAccessKey`, otherwise console steps |
|
|
79
|
+
| SendGrid (`SG.`) | ✅ scopes | ✅ the key deletes itself if it has API-key permissions |
|
|
80
|
+
| Stripe (live and test keys), OpenAI, Anthropic, OpenRouter, Groq, Hugging Face, Replicate, DigitalOcean, npm, Telegram, Slack webhooks | ✅ (account or username where the API returns it) | ❌ the provider has no API for it, so you get the exact page or command |
|
|
81
|
+
| Google API keys, Shopify, PyPI, Docker Hub, Twilio, Postman, Perplexity, Linear, Azure Storage, private keys, JWTs, credentials in URLs and Basic auth headers, generic high-entropy secrets | detected, not verified | step-by-step rotation guidance |
|
|
82
|
+
|
|
83
|
+
## How it compares
|
|
84
|
+
|
|
85
|
+
| | leakkill | Kingfisher | Betterleaks | Gitleaks | TruffleHog OSS | GitGuardian |
|
|
86
|
+
|---|---|---|---|---|---|---|
|
|
87
|
+
| License / price | MIT, free | Apache 2.0, free | MIT, free | MIT, free | AGPL, free | free for individuals, paid for teams |
|
|
88
|
+
| Runs fully local | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ SaaS |
|
|
89
|
+
| Install | `pip`, zero dependencies | Rust binary | Go binary | Go binary | Go binary | CLI + account |
|
|
90
|
+
| Detection rules | 246 | ~485 | 463 | 150+ | 800+ | 550+ |
|
|
91
|
+
| Checks if a key is live | ✅ 17 providers | ✅ hundreds | ✅ | ❌ | ✅ 700+ | ✅ |
|
|
92
|
+
| Revokes from the CLI | ✅ 6 providers | ✅ some providers | ❌ | ❌ | ❌ (Enterprise) | partial |
|
|
93
|
+
| Remediation report with ordered steps + history purge | ✅ | HTML report, blast-radius map | ❌ | ❌ | ❌ | ✅ |
|
|
94
|
+
| Guards AI coding agents | ✅ Claude Code, Cursor, Copilot, Codex | ❌ | ❌ | ❌ | ❌ | ✅ (hooks, paid platform) |
|
|
95
|
+
| Scans Slack / Jira / S3 / Docker | ❌ | ✅ | ❌ | ❌ | ✅ | ✅ |
|
|
96
|
+
| SARIF / baselines | ✅ / ✅ hashes only | ✅ / ✅ | ✅ / ✅ | ✅ / ✅ (stores secrets) | ✅ / ❌ | ✅ / ✅ |
|
|
97
|
+
|
|
98
|
+
**Where each is strongest** (accuracy below): Betterleaks finds the most real credentials; Kingfisher has the
|
|
99
|
+
fewest false alarms and the broadest platform coverage with validation and revocation; TruffleHog verifies the
|
|
100
|
+
most providers. leakkill's niche is a dependency-free `pip install` that goes from finding to revoked key to
|
|
101
|
+
cleanup plan, guards AI coding agents, and is the best of these at passwords embedded in URLs and Basic auth headers.
|
|
102
|
+
|
|
103
|
+
Figures from each project's documentation, October 2026. Use what fits: running two scanners is common.
|
|
104
|
+
|
|
105
|
+
### Detection rules
|
|
106
|
+
|
|
107
|
+
leakkill's own 32 rules cover the providers it can verify and revoke. On top of those, it includes
|
|
108
|
+
**214 provider rules from [Gitleaks](https://github.com/gitleaks/gitleaks)** (MIT), translated to Python by
|
|
109
|
+
[`tools/import_gitleaks.py`](tools/import_gitleaks.py) from a pinned, checksum-verified release, together with
|
|
110
|
+
Gitleaks' entropy thresholds and allowlists. Thank you to the Gitleaks maintainers. See
|
|
111
|
+
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
112
|
+
|
|
113
|
+
### Speed
|
|
114
|
+
|
|
115
|
+
Measured on 4 cores (October 2026), wall-clock time for a full scan:
|
|
116
|
+
|
|
117
|
+
| Repository | leakkill | Gitleaks 8.28 |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| psf/requests (130 files) | 0.36 s | 0.63 s |
|
|
120
|
+
| pallets/flask (236 files) | 0.31 s | 0.64 s |
|
|
121
|
+
| expressjs/express (214 files) | 0.23 s | 0.48 s |
|
|
122
|
+
| pallets/flask full history (5,557 commits) | 2.0 s | 1.5 s |
|
|
123
|
+
| django/django (7,000 files, 43 MB) | 2.8 s | 1.4 s |
|
|
124
|
+
|
|
125
|
+
On typical repositories leakkill is faster; on very large ones Gitleaks (Go) is about 2x faster.
|
|
126
|
+
|
|
127
|
+
### Tested with real credentials
|
|
128
|
+
|
|
129
|
+
End to end on Windows with real, throwaway credentials:
|
|
130
|
+
|
|
131
|
+
| Credential | `verify` | `revoke --yes` | `verify` again |
|
|
132
|
+
|---|---|---|---|
|
|
133
|
+
| GitHub token | LIVE, correct user | REVOKED (HTTP 202) | DEAD |
|
|
134
|
+
| Discord webhook | LIVE, correct server and channel | REVOKED (HTTP 204) | DEAD |
|
|
135
|
+
| Slack bot token | LIVE, correct bot and workspace | REVOKED | DEAD (the app was uninstalled, as Slack documents) |
|
|
136
|
+
| Slack webhook | LIVE | (died with the app) | DEAD |
|
|
137
|
+
| Stripe test key | LIVE, correct account, "test mode" | manual roll in dashboard | |
|
|
138
|
+
| Hugging Face token | LIVE, correct user and token role | manual delete | |
|
|
139
|
+
|
|
140
|
+
Against the real AWS, GitLab, Anthropic and npm APIs, invalid keys are correctly reported DEAD.
|
|
141
|
+
Providers not yet tested with a live key (OpenAI, OpenRouter, Groq, Replicate, DigitalOcean,
|
|
142
|
+
SendGrid, Telegram) are covered by tests using simulated API responses.
|
|
143
|
+
|
|
144
|
+
### Accuracy (independent dataset)
|
|
145
|
+
|
|
146
|
+
On [Samsung CredData](https://github.com/Samsung/CredData), 67,896 lines labeled by people, every tool scored
|
|
147
|
+
by the same script ([details and how to reproduce](benchmarks/README.md)):
|
|
148
|
+
|
|
149
|
+
| | precision | recall | F1 | without OpenSSL test vectors (P / R / F1) | passwords in URLs | HTTP Basic auth |
|
|
150
|
+
|---|---|---|---|---|---|---|
|
|
151
|
+
| **leakkill 0.6** | 0.824 | 0.510 | **0.630** | 0.921 / 0.300 / 0.453 | **182/209** | **601/601** |
|
|
152
|
+
| Betterleaks 1.9 | 0.712 | **0.562** | 0.628 | 0.585 / **0.379** / **0.460** | 96/209 | 10/601 |
|
|
153
|
+
| Gitleaks 8.28 | 0.860 | 0.453 | 0.594 | 0.910 / 0.218 / 0.351 | 0/209 | 0/601 |
|
|
154
|
+
| Kingfisher 2.9 (no validation) | **0.961** | 0.104 | 0.187 | **0.925** / 0.079 / 0.145 | 20/209 | 5/601 |
|
|
155
|
+
| TruffleHog 3.97 (no verification) | 0.579 | 0.024 | 0.045 | 0.486 / 0.026 / 0.049 | 59/209 | 0/601 |
|
|
156
|
+
|
|
157
|
+
Compare on the "without OpenSSL test vectors" column: those are public crypto test data, not leaks. There,
|
|
158
|
+
leakkill and Betterleaks are level on F1. Betterleaks finds more credentials (recall 0.379 vs 0.300); leakkill
|
|
159
|
+
raises far fewer false alarms (precision 0.921 vs 0.585). leakkill is far ahead on passwords in URLs and Basic
|
|
160
|
+
auth headers, because it decodes and checks them. The generic rules were tuned on this dataset, which flatters
|
|
161
|
+
leakkill somewhat; false alarms on four clean repositories (requests, flask, django, express) stayed at
|
|
162
|
+
1 / 2 / 3 / 0.
|
|
163
|
+
|
|
164
|
+
### How it's tested
|
|
165
|
+
|
|
166
|
+
- 137 tests on Linux, macOS and Windows with Python 3.9 and 3.13; CI fails below 88% branch coverage (currently 93%).
|
|
167
|
+
- Property-based fuzz tests: the scanner never crashes on random input, never prints a raw secret, finds a
|
|
168
|
+
planted token in any surrounding text, and gives the same answer scanning a whole file or line by line.
|
|
169
|
+
(Fuzzing found two real bugs before release: a guard crash and a slow-input case, both fixed.)
|
|
170
|
+
- Coverage-guided fuzzing with Atheris via ClusterFuzzLite on every pull request and weekly, of the scanner,
|
|
171
|
+
the transcript reader and the AI agent guard. Its first run found a real bug in under a minute: the
|
|
172
|
+
guard could quote a secret hidden in a file name back to the agent. Fixed, with a regression test.
|
|
173
|
+
- Every one of the 246 rules is checked in CI against hostile input built from its own keywords, because
|
|
174
|
+
Python's regex engine, unlike Go's, can be made to backtrack for minutes. The sweep found and fixed 4
|
|
175
|
+
such rules among those imported from Gitleaks.
|
|
176
|
+
- Live tests against real APIs with real throwaway keys (above), and of the Claude Code guard in the real CLI.
|
|
177
|
+
- OpenSSF Best Practices (passing), SonarCloud, OpenSSF Scorecard, pinned and hash-locked CI tooling, signed PyPI provenance, Sigstore-signed GitHub releases (see SECURITY.md).
|
|
178
|
+
|
|
179
|
+
## Safety model
|
|
180
|
+
|
|
181
|
+
- `scan` never touches the network.
|
|
182
|
+
- A secret is only ever sent to **the provider that issued it**. Hosts are hard-coded, and HTTP
|
|
183
|
+
redirects are never followed, so a credential can't be bounced to another server (this is tested).
|
|
184
|
+
- Verification uses read-only identity calls: GitHub `GET /user`, Slack `auth.test`, AWS
|
|
185
|
+
`GetCallerIdentity` and so on.
|
|
186
|
+
- `revoke` is a dry run unless you pass `--yes`, and only touches keys that verified as live.
|
|
187
|
+
- Raw secrets are never printed or written to the report. The only exception is the opt-in
|
|
188
|
+
`report --replacements FILE` (needed by `git filter-repo`), which is created with permissions 600 and never overwrites an existing file.
|
|
189
|
+
|
|
190
|
+
## Cleaning git history
|
|
191
|
+
|
|
192
|
+
```sh
|
|
193
|
+
leakkill revoke --history --yes # 1. kill live keys first: history rewrites don't help once copied
|
|
194
|
+
pip install git-filter-repo
|
|
195
|
+
leakkill report --history --replacements .leakkill-replacements.txt
|
|
196
|
+
git filter-repo --replace-text .leakkill-replacements.txt
|
|
197
|
+
rm .leakkill-replacements.txt
|
|
198
|
+
git push --force --all && git push --force --tags # every collaborator must re-clone
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## AI coding agent guard
|
|
202
|
+
|
|
203
|
+
```sh
|
|
204
|
+
leakkill install-agent-hooks # all four, in this project
|
|
205
|
+
leakkill install-agent-hooks cursor codex # just these
|
|
206
|
+
leakkill install-agent-hooks --global # for your user account, every project
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
| Agent | Config written | Secret in a prompt | Reading `.env` / keys (file or shell) | Writing a key into code |
|
|
210
|
+
|---|---|---|---|---|
|
|
211
|
+
| Claude Code | `.claude/settings.json` | blocked | blocked | blocked |
|
|
212
|
+
| Cursor | `.cursor/hooks.json` | blocked | blocked, and any file whose content holds a key | blocked |
|
|
213
|
+
| GitHub Copilot CLI | `.github/hooks/leakkill.json` | warned only (Copilot ignores prompt-hook decisions) | blocked | blocked |
|
|
214
|
+
| OpenAI Codex | `.codex/hooks.json` | blocked | blocked | blocked, per file of each `apply_patch` |
|
|
215
|
+
|
|
216
|
+
Sensitive files are `.env` (but not `.env.example`), `*.pem`, `*.key`, `id_rsa`, `.npmrc`, `.pypirc` and
|
|
217
|
+
similar; a shell command that names one (`cat`, `grep`, `base64`, `python -c`, `cp` …) is blocked too.
|
|
218
|
+
Writing keys **into** `.env` is allowed, since that is where they belong. If the guard itself fails, it
|
|
219
|
+
blocks rather than lets a secret through. Codex only runs hooks you trust: after installing, type
|
|
220
|
+
`/hooks` in Codex and trust the leakkill hook.
|
|
221
|
+
|
|
222
|
+
Tested live with the Claude Code CLI: prompts with keys, `Read .env`, `cat .env`, `grep . .env` and
|
|
223
|
+
writing an AWS key into `app.py` were all blocked. Cursor, Copilot and Codex are tested against the hook
|
|
224
|
+
formats in their documentation, through the same command they run; if you see one misbehave, please open
|
|
225
|
+
an issue. The check is pattern-based: a command that builds the file name at runtime can get past it.
|
|
226
|
+
Pair it with OS-level permissions for hard guarantees.
|
|
227
|
+
|
|
228
|
+
## Secrets your AI agents already stored
|
|
229
|
+
|
|
230
|
+
```sh
|
|
231
|
+
leakkill scan --agents # what's there
|
|
232
|
+
leakkill verify --agents # ...and which of those keys still work
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
AI coding agents keep plain-text session transcripts and prompt histories, and MCP server configs often hold
|
|
236
|
+
API keys. A key you pasted into a chat, or a `.env` the agent read, stays on disk there, and was sent to the
|
|
237
|
+
model provider. `--agents` scans, on your machine only:
|
|
238
|
+
|
|
239
|
+
- Claude Code (`~/.claude.json`, `~/.claude/` including session transcripts), Codex (`~/.codex/`), GitHub
|
|
240
|
+
Copilot CLI (`~/.copilot/`), Gemini CLI (`~/.gemini/`), Cursor, Windsurf, Claude Desktop and VS Code MCP configs
|
|
241
|
+
- this project's `.mcp.json`, `.cursor/mcp.json`, `.vscode/mcp.json`, `.claude/settings*.json`, `.gemini/settings.json`
|
|
242
|
+
|
|
243
|
+
Transcripts are decoded, so a key behind JSON escapes is still found and reported at its line. The agents' own
|
|
244
|
+
login files (`~/.codex/auth.json`, `~/.claude/.credentials.json`, Gemini's OAuth file) are skipped, since that is
|
|
245
|
+
where their tokens belong. Cursor's chat history is stored in a database and is not scanned yet.
|
|
246
|
+
|
|
247
|
+
## Use in CI (GitHub Action)
|
|
248
|
+
|
|
249
|
+
```yaml
|
|
250
|
+
- uses: actions/checkout@v7
|
|
251
|
+
- uses: ayushanand27/leakkill@v0
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
The build fails if a secret is found, and the incident report appears in the job summary. Options:
|
|
255
|
+
|
|
256
|
+
```yaml
|
|
257
|
+
- uses: ayushanand27/leakkill@v0
|
|
258
|
+
with:
|
|
259
|
+
path: . # files or directories to scan
|
|
260
|
+
exclude-tests: true # skip test_* files and tests/ dirs
|
|
261
|
+
history: true # scan every commit (needs `fetch-depth: 0` on checkout)
|
|
262
|
+
verify: true # check secrets with their providers; fail only if one is LIVE
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
The action exposes `found` (the number of unique secrets) as an output. Outside GitHub Actions, use
|
|
266
|
+
`pip install leakkill && leakkill scan .`.
|
|
267
|
+
|
|
268
|
+
### Findings in the GitHub Security tab (SARIF)
|
|
269
|
+
|
|
270
|
+
```yaml
|
|
271
|
+
permissions:
|
|
272
|
+
contents: read
|
|
273
|
+
security-events: write # needed to upload SARIF
|
|
274
|
+
steps:
|
|
275
|
+
- uses: actions/checkout@v7
|
|
276
|
+
- uses: ayushanand27/leakkill@v0
|
|
277
|
+
id: leakkill
|
|
278
|
+
- uses: github/codeql-action/upload-sarif@v4
|
|
279
|
+
if: always() # upload even when leakkill fails the build
|
|
280
|
+
with:
|
|
281
|
+
sarif_file: ${{ steps.leakkill.outputs.sarif-file }}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Outside the Action: `leakkill scan --sarif results.sarif .` (validated against the OASIS SARIF 2.1.0 schema).
|
|
285
|
+
The SARIF never contains secrets, only a masked prefix and a truncated hash.
|
|
286
|
+
|
|
287
|
+
## GitLab CI
|
|
288
|
+
|
|
289
|
+
```yaml
|
|
290
|
+
leakkill:
|
|
291
|
+
image: python:3.12-slim
|
|
292
|
+
script:
|
|
293
|
+
- pip install leakkill
|
|
294
|
+
- leakkill scan --exclude-tests --sarif gl-leakkill.sarif .
|
|
295
|
+
artifacts:
|
|
296
|
+
when: always
|
|
297
|
+
paths: [gl-leakkill.sarif]
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Baselines: adopt it on a repo that already has old findings
|
|
301
|
+
|
|
302
|
+
```sh
|
|
303
|
+
leakkill scan --write-baseline .leakkill-baseline.json . # accept what's there today
|
|
304
|
+
leakkill scan --baseline .leakkill-baseline.json . # from now on, fail only on new secrets
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
The baseline file is safe to commit: it holds only salted scrypt hashes, never secrets, and scrypt is
|
|
308
|
+
deliberately slow so even weak passwords can't practically be brute-forced back out of it. (Gitleaks'
|
|
309
|
+
baseline is its previous report, which includes the secrets themselves.) Accepting a finding into the
|
|
310
|
+
baseline doesn't make it safe: revoke real keys first.
|
|
311
|
+
|
|
312
|
+
## Use with the pre-commit framework
|
|
313
|
+
|
|
314
|
+
```yaml
|
|
315
|
+
# .pre-commit-config.yaml
|
|
316
|
+
repos:
|
|
317
|
+
- repo: https://github.com/ayushanand27/leakkill
|
|
318
|
+
rev: v0.6.0
|
|
319
|
+
hooks:
|
|
320
|
+
- id: leakkill
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Or without the framework: `leakkill install-hook`.
|
|
324
|
+
|
|
325
|
+
## Suppressing false positives
|
|
326
|
+
|
|
327
|
+
- Add `leakkill:ignore` on a line.
|
|
328
|
+
- List paths or globs in `.leakkillignore` (for example `fixtures/` or `*.snap`).
|
|
329
|
+
- High-entropy matches ignore placeholders (`your_key`, `example`, `${VAR}`), variables named
|
|
330
|
+
test/example/fake/mock, password hashes and values without digits.
|
|
331
|
+
|
|
332
|
+
## Known limitations
|
|
333
|
+
|
|
334
|
+
- Finds fewer real credentials than Betterleaks (recall 0.30 vs 0.38 on real code in CredData, with far fewer
|
|
335
|
+
false alarms), and has fewer rules than Kingfisher or TruffleHog.
|
|
336
|
+
- Scans files, git history and local AI agent files: not Slack, Jira, Confluence, S3 or Docker images.
|
|
337
|
+
- The agent guard is pattern-based: a command that builds a file name at runtime can get past it. The Cursor,
|
|
338
|
+
Copilot and Codex guards are tested against their documented hook formats; only Claude Code was tested in the
|
|
339
|
+
real app. Copilot ignores prompt hooks, so a key typed into a Copilot prompt is warned about, not blocked.
|
|
340
|
+
- `--agents` doesn't read Cursor's chat history (a database), only its MCP config.
|
|
341
|
+
- On very large repositories (tens of MB) scanning is about 2x slower than Gitleaks.
|
|
342
|
+
- Verification behind a proxy that injects its own credentials (some corporate and sandbox proxies
|
|
343
|
+
do) can report the proxy's identity. Run `verify` from a normal network.
|
|
344
|
+
- AWS keys can only be verified when the secret key is found too (any file in the scan).
|
|
345
|
+
- Stripe, OpenAI, Anthropic, npm and Telegram offer no revoke API, so those need a manual click.
|
|
346
|
+
|
|
347
|
+
MIT licensed.
|