Skip to content

chore: stop committing .claude/settings.local.json - #351

Open
Anubhav-2003 wants to merge 2 commits into
kbwo:mainfrom
Anubhav-2003:chore/untrack-claude-local-settings
Open

Anubhav-2003 wants to merge 2 commits into
kbwo:mainfrom
Anubhav-2003:chore/untrack-claude-local-settings

Conversation

@Anubhav-2003

@Anubhav-2003 Anubhav-2003 commented Nov 20, 2026 •

Copy link
Copy Markdown

Summary

While setting up the repo with Claude Code, I noticed .claude/settings.local.json is committed. That's where Claude Code saves each command you approve, keys included, so it's meant to stay on one machine. Ran npx @gglint/cli secrets and it flagged it:

.claude/settings.local.json
  ✗   1:1  this file is in git, but it's Claude Code's personal settings, where it saves the commands you allow, secrets and all, meant for one person's machine

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.toml and CLAUDE.md the 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, plus git 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:

  • A pre-commit hook (husky runs gglint secrets --staged, with @gglint/cli pinned 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.
  • A CI check on pull requests (.github/workflows/agent-secrets.yml, read-only, no comments). Hooks run locally, so they can be skipped with --no-verify or 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:

  • writes a token in a known format (GitHub, Anthropic, AWS, Slack, Google and others) into an agent file
  • puts a password in a database URL, or a key in a command such as curl -H "Authorization: Bearer …"
  • writes a value under a name such as password, api_key or Authorization instead of a ${VARIABLE}
  • commits .claude/settings.local.json, CLAUDE.local.md, or Claude Code's or Codex's login file, which are meant for one person's machine

Neither 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 secrets flags the file before this change and passes after it.

I work on gglint, so happy to adjust anything here.

Anubhav-2003 and others added 2 commits November 20, 2026 18:35
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>
@Anubhav-2003 Anubhav-2003 changed the title chore: stop committing .claude/settings.local.json chore: keep secrets out of agent config files with gglint Nov 20, 2026
@Anubhav-2003 Anubhav-2003 changed the title chore: keep secrets out of agent config files with gglint chore: stop committing .claude/settings.local.json Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant