Skip to content

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

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

Anubhav-2003 wants to merge 2 commits into
TanStack: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 (your existing husky hook now also 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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: afd816f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The local Claude settings file was deleted and added to .gitignore. Secret scanning was added to the pre-commit hook and to a pull-request workflow.

Changes: Local Claude settings cleanup

Layer / File(s) Summary
Remove and ignore local settings
.claude/settings.local.json, .gitignore
The local settings file was deleted. .gitignore now excludes .claude/settings.local.json.

Secret scanning

Layer / File(s) Summary
Add pre-commit and pull-request checks
package.json, .husky/pre-commit, .github/workflows/agent-secrets.yml
The root development dependencies include @gglint/cli version 0.5.1. The pre-commit hook scans staged changes. The pull-request workflow runs the pinned gglint action with commenting disabled.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: jherr

Merge Risk: Minimal · up to afd81

This change stops tracking a personal Claude settings file and adds secret scanning to commits and pull requests. No merge-blocking risk was found. Contributors who want to keep their local approved commands should copy the file before pulling.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title "chore: stop committing .claude/settings.local.json" matches the main change. The PR removes the file from Git tracking and adds it to .gitignore. The other changes (a secrets-check workflow…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "chore: stop committing .claude/settings.local.json" matches the main change. The PR removes the file from Git tracking and adds it to .gitignore. The other changes (a secrets-check workflow, a pre-commit hook, and the gglint dev dependency) support the same goal of keeping local agent settings and secrets out of the repository. The title does not describe those supporting changes, but it names the primary change.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 003973eb-2a52-4aac-85d8-7f0e216c6505
Commits

Reviewing files that changed from the base of the PR and between 00b0780 and afd816f.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 3

  • .github/workflows/agent-secrets.yml
  • .husky/pre-commit
  • package.json

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

…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>
@Anubhav-2003
Anubhav-2003 requested a review from a team as a code owner November 20, 2026 13:25
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​gglint/​cli@​0.5.167100979180

View full report

@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