Repository navigation
chore: stop committing .claude/settings.local.json - #351
Open
Anubhav-2003 wants to merge 2 commits into
Open
Anubhav-2003 wants to merge 2 commits into
Anubhav-2003 wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uest Adds gglint as a pinned dev dependency with a pre-commit hook that runs `gglint secrets --staged`, and a GitHub workflow that runs `gglint secrets` on pull requests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.I work on gglint, so happy to adjust anything here.