whatileaked 0.1.0

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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +244 -0
  3. package/dist/cli.js +2698 -0
  4. package/package.json +56 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Selan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,244 @@
1
+ # whatileaked
2
+
3
+ Your coding agent saves every conversation to your disk. If you ever pasted an
4
+ API key into a chat, or asked the agent to read a `.env` file, that key is now
5
+ sitting in a log file on your laptop — and it was uploaded to Anthropic or
6
+ OpenAI the moment you sent the message.
7
+
8
+ Secret scanners point at repositories and CI. You can aim one at `~/.claude` by
9
+ hand, but nobody does — it is not a repo, it is not in CI, and it does not look
10
+ like a place credentials live. It is.
11
+
12
+ This tool looks there and tells you what it finds.
13
+
14
+ ---
15
+
16
+ ## Install it
17
+
18
+ You don't. Open a terminal and run:
19
+
20
+ ```sh
21
+ npx whatileaked scan
22
+ ```
23
+
24
+ `npx` comes with Node.js. It downloads the tool, runs it once, and does not
25
+ install anything permanently.
26
+
27
+ **No Node.js?** Check with `node --version`. If that errors, install Node from
28
+ [nodejs.org](https://nodejs.org) (any version 20 or newer) and try again.
29
+
30
+ If you'd rather keep it around:
31
+
32
+ ```sh
33
+ npm install -g whatileaked # then just: whatileaked scan
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Run it
39
+
40
+ There are two commands and no options.
41
+
42
+ ```sh
43
+ npx whatileaked scan # look, and tell you. Changes nothing.
44
+ npx whatileaked wipe # remove what it found. Asks before touching anything.
45
+ ```
46
+
47
+ Running `npx whatileaked` with no command just lists them.
48
+
49
+ A scan takes about 20 seconds for a year of history. It reads files, and that
50
+ is all — no network connection is made at any point.
51
+
52
+ ---
53
+
54
+ ## Reading the output
55
+
56
+ ### When it finds nothing
57
+
58
+ ```
59
+ scanned 561 transcripts · 197,016 messages
60
+
61
+ No credentials found.
62
+ ```
63
+
64
+ Nothing to do. This is the good outcome.
65
+
66
+ ### When it finds something
67
+
68
+ ```
69
+ scanned 561 transcripts · 196,986 messages
70
+
71
+ * aws-access-token 2 secrets
72
+ f0b93847 billing-api sent 25 times
73
+ const SECOND_AWS_KEY = '***
74
+ ~/.claude/projects/-Users-you-code-billing-api/965db026.jsonl
75
+ 2bcf6de0 deploy-tool sent once
76
+ AWS_ACCESS_KEY_ID=***
77
+ ~/.claude/projects/-Users-you-code-deploy-tool/c8dd5ea8.jsonl
78
+
79
+ * github-pat 1 secret
80
+ c40a1f77 auth-service sent 4 times
81
+ gh auth login --with-token ***
82
+ ~/.claude/projects/-Users-you-code-auth-service/1254ccd7.jsonl
83
+
84
+ 3 credentials sent to a model provider.
85
+ ```
86
+
87
+ Every line, explained:
88
+
89
+ | Part | Means |
90
+ | --- | --- |
91
+ | `* aws-access-token` | The kind of credential. These names come from [gitleaks](https://github.com/gitleaks/gitleaks), so you can search any of them. |
92
+ | `2 secrets` | How many *different* credentials of that kind. |
93
+ | `f0b93847` | A fingerprint — **not** the secret. See below. |
94
+ | `billing-api` | The project folder you were working in at the time. |
95
+ | `sent 25 times` | How many messages carried it. One paste gets re-sent with every later message in the conversation. |
96
+ | `const SECOND_AWS_KEY = '***` | The text right before the secret, with the secret blanked out. This is how you judge it. |
97
+ | `~/.claude/projects/…` | The file to open if you want the whole story. |
98
+
99
+ **What is a fingerprint?** A short one-way hash of the secret. The tool never
100
+ prints the credential itself — not even the first few characters — because you
101
+ might paste this output somewhere public. The fingerprint is still useful: the
102
+ same credential always produces the same code, so two rows sharing a code are
103
+ one key you reused in two places, and two different codes are two different
104
+ keys.
105
+
106
+ ---
107
+
108
+ ## Is it a real key, or just a test fixture?
109
+
110
+ Some findings will be fake. A credential-shaped string in a test file is still
111
+ credential-shaped, and no scanner can tell them apart. You can:
112
+
113
+ 1. **Read the masked line.** `const TEST_KEY = ***` is a fixture.
114
+ `AWS_ACCESS_KEY_ID=***` probably is not.
115
+ 2. **Look for a repeated fingerprint.** The same code under several different
116
+ projects is a credential you genuinely reused.
117
+ 3. **Open the file.** The path is printed for exactly this.
118
+
119
+ Well-known example keys are already filtered out — AWS's own published
120
+ `AKIAIOSFODNN7EXAMPLE` is never reported.
121
+
122
+ ---
123
+
124
+ ## Found something real. Now what?
125
+
126
+ **Rotate the key first.** Log into AWS, GitHub, wherever it came from, and issue
127
+ a new one. This matters more than anything below: the old key has already left
128
+ your machine, and deleting your local copy does not call it back.
129
+
130
+ **Then, if you want, clean your disk:**
131
+
132
+ ```sh
133
+ npx whatileaked wipe
134
+ ```
135
+
136
+ It shows you every file it would touch, then stops and waits:
137
+
138
+ ```
139
+ replacing credentials in your local transcripts with a placeholder
140
+
141
+ 3 secrets across 2 files
142
+
143
+ * billing-api 2 secrets in 2 messages
144
+ ~/.claude/projects/-Users-you-code-billing-api/965db026.jsonl
145
+ * auth-service 1 secret in 1 message
146
+ ~/.claude/projects/-Users-you-code-auth-service/1254ccd7.jsonl
147
+
148
+ Every secret above will be replaced with a placeholder.
149
+ This rewrites the files and cannot be undone.
150
+
151
+ It does not un-send anything — all of these already reached a model
152
+ provider. Rotate them whether or not you wipe.
153
+
154
+ Type wipe to rewrite these files, or anything else to stop:
155
+ ```
156
+
157
+ You must type the full word `wipe`. Pressing `y` does nothing, and a scripted
158
+ run cannot answer at all — `yes | whatileaked wipe` changes no files.
159
+
160
+ Each secret becomes `[REDACTED BY whatileaked: aws-access-token]`. Only the
161
+ lines containing a secret change, the rest of the file is untouched, and the
162
+ file stays valid so your agent can still read its own history.
163
+
164
+ ---
165
+
166
+ ## When something goes wrong
167
+
168
+ | What you see | What it means | What to do |
169
+ | --- | --- | --- |
170
+ | `command not found: npx` | Node.js isn't installed. | Install it from [nodejs.org](https://nodejs.org). |
171
+ | `unknown command "..." — expected "scan" or "wipe"` | A typo. | Check the spelling. |
172
+ | `scanned 0 transcripts` | No agent history where it looked. | You may not use Claude Code or Codex, or history lives elsewhere. See *Where it looks*. |
173
+ | `N messages could not be scanned` | Some entries were unreadable and were skipped. | The count is shown so a partial scan never looks like a clean one. Please [open an issue](https://github.com/selan-ai/whatileaked/issues). |
174
+ | `Not confirmed. Nothing was changed.` | `wipe` didn't get the word `wipe`. | Expected. Nothing was touched. |
175
+ | It seems stuck | A big history takes ~20 seconds. | Give it a minute before worrying. |
176
+
177
+ **Exit codes**, if you want to script it:
178
+
179
+ | Code | Meaning |
180
+ | --- | --- |
181
+ | `0` | Nothing found |
182
+ | `1` | Credentials found |
183
+ | `2` | An error |
184
+
185
+ ```sh
186
+ npx whatileaked scan || echo "found something"
187
+ ```
188
+
189
+ ---
190
+
191
+ ## Where it looks
192
+
193
+ | Agent | Folder |
194
+ | --- | --- |
195
+ | Claude Code | `~/.claude/projects/` |
196
+ | Codex | `~/.codex/sessions/` |
197
+
198
+ Nowhere else. It does not read your repos, your shell history, or your
199
+ environment. Adding support for another agent is one small file — pull requests
200
+ welcome.
201
+
202
+ ---
203
+
204
+ ## What it will never do
205
+
206
+ - **Print a secret.** Findings carry a rule name and a fingerprint. No type in
207
+ this codebase has a field that can hold a credential value.
208
+ - **Make a network request.** Not for results, not to check for updates.
209
+ Nothing leaves your machine, ever.
210
+ - **Write anything** — unless you run `wipe` and type the word.
211
+ - **Pull in dependencies.** Installing it adds exactly one package: this one.
212
+
213
+ ---
214
+
215
+ ## Disclosure
216
+
217
+ Built by [Selan](https://selan.ai). Selan sells a proxy that redacts these
218
+ before they leave your machine, so we have an obvious interest in you finding a
219
+ big number here.
220
+
221
+ The scanner is a few hundred lines with no dependencies. Read
222
+ `src/scan/scanner.ts` and check for yourself.
223
+
224
+ ---
225
+
226
+ ## Contributing
227
+
228
+ Node 24+ to develop (tests read the TypeScript sources directly). The published
229
+ build is plain JavaScript and runs on Node 20+.
230
+
231
+ ```sh
232
+ pnpm install
233
+ pnpm test
234
+ pnpm typecheck
235
+ pnpm lint
236
+ ```
237
+
238
+ Detection rules come from [gitleaks](https://github.com/gitleaks/gitleaks),
239
+ used unmodified; `pnpm gen:secret-rules` regenerates them from upstream.
240
+ `docs/design.md` covers how the scanner works and why it is built this way.
241
+
242
+ ## License
243
+
244
+ MIT. gitleaks rule definitions are MIT too.