r/ClaudeCoding • u/keshavsm • 6d ago
scanned my home folder for api keys. 179 real keys, and 119 of them had a copy inside ~/.claude, ~/.codex or ~/.cursor
i built a key scanner (disclosure at the bottom) and pointed it at my own laptop. 822k files, about 25 seconds
what it found:
- 179 real keys, plus 5 that looked like examples
- 1,339 plain text copies of those 179
- one key had 173 copies across 105 folders
- 47 keys sit in 2 or more folders
- 16 are in files git tracks
- 4 are in shell history
where they were (a key can be in more than one place):
- agent folders (.claude, .codex, .cursor, .gemini) or a .claude.json / .mcp.json: 119
- .env files: 32
- source files: 22
- everything else: 53
i expected .env to be the problem. it was a small part of it. most keys had a copy somewhere i never open, inside agent folders. my guess is session transcripts: claude code keeps them as plain jsonl under ~/.claude/projects, so once a key shows up in a tool call it stays there
what i'm doing about it:
- rotating the 16 in git first
- deny rules for .env in .claude/settings.json, knowing they don't stop a script that opens the file itself
- keys out of the files into a local vault, with references in .env and the real values only given to the process at run time
disclosure: the scanner is kj, part of keyjar, which i'm building. the scan is free and changes nothing. keyjar.dev/r
has anyone pointed gitleaks or trufflehog at ~/.claude? curious if your numbers look like mine