Repository navigation
chore: stop committing .claude/settings.local.json - #586
Anubhav-2003 wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…request Adds gglint as a pinned dev dependency, runs `gglint secrets --staged` from the husky pre-commit hook, and adds a GitHub workflow that runs `gglint secrets` on pull requests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Summary
While setting up the repo with Claude Code, I noticed
.claude/settings.local.jsonis committed. That's where Claude Code saves each command you approve, keys included, so it's meant to stay on one machine. Rannpx @gglint/cli secretsand it flagged it:Coding agents' config files have become a common place for secrets to leak. When you approve a command in Claude Code, it saves the command, keys and all, in
.claude/settings.local.json, and GitGuardian found about 31,000 secrets in those files on public GitHub (report). Keys end up in.mcp.json,.codex/config.tomlandCLAUDE.mdthe same way.Nothing in this repo's copy is a secret today, so there's nothing to rotate. Fixed with
npx @gglint/cli secrets --fix, which added it to.gitignore, plusgit rm --cached .claude/settings.local.json, as gglint suggests, so it leaves git but stays on disk.So it doesn't come back, this adds two checks:
gglint secrets --staged, with@gglint/clipinned as a dev dependency). This is the one that actually prevents a leak: it stops the commit on the contributor's machine, before the key exists anywhere else. Once a key reaches GitHub it's in the history, and has to be rotated even if the commit is reverted..github/workflows/agent-secrets.yml, read-only, no comments). Hooks run locally, so they can be skipped with--no-verifyor never set up on a new clone; this catches whatever gets past them. If you'd rather not have it, I'm happy to drop it and keep just the hook.Both fail, and point at the line, when a change:
curl -H "Authorization: Bearer …"password,api_keyorAuthorizationinstead of a${VARIABLE}.claude/settings.local.json,CLAUDE.local.md, or Claude Code's or Codex's login file, which are meant for one person's machineNeither prints a secret's value.
One heads-up: pulling this deletes your local copy of
.claude/settings.local.json, so copy it aside first if you want to keep your approved commands.Testing
npx @gglint/cli secretsflags the file before this change and passes after it.