Skip to content

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

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

Anubhav-2003 wants to merge 3 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.

Summary by CodeRabbit

  • Chores
    • Added automated checks for accidentally exposed secrets during pull requests and before commits.
    • Removed the local Claude settings file and excluded it from version control, so local settings are not included in repository changes.

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 pnpm exec gglint secrets on Ubuntu with read-only repository contents permission.

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

Change: Other

Suggested reviewers: jherr

Merge Risk: Minimal · up to f317f

This change removes a personal settings file from version control and adds secret scanning to commits and pull requests. No concrete merge-blocking risk was identified; contributors should copy the local settings file aside before pulling if they want to keep it.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "chore: stop committing .claude/settings.local.json" matches the main change. The PR removes the tracked .claude/settings.local.json file (the diff deletes it and adds it to .gitignore). The…
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.
Full details: Title check

Explanation

The title "chore: stop committing .claude/settings.local.json" matches the main change. The PR removes the tracked .claude/settings.local.json file (the diff deletes it and adds it to .gitignore). The title is concise, specific, and follows a conventional commit prefix. The secret-scanning hooks and CI workflow are secondary changes that the title does not mention, which is acceptable.

Finishing Touches

Generate unit tests (beta)

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

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: 68c425c6-8b4c-4b34-8c03-c981e998b37b
Commits

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

Files selected for processing: 1

  • .github/workflows/agent-secrets.yml

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 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

socket-security Bot commented Nov 20, 2026 •

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
@tannerlinsley

Copy link
Copy Markdown
Member

Thanks for catching the personal settings file. I adjusted CI to use the same locked npm scanner as the local hook, through the repo’s existing pinned setup action.

AI review notes:
Reviewed head f317f4be201bab3d5c6ea2ea1385a825f3c5c2e1. The original contribution and author credit are preserved.
The normal hook passed all 10 builds, 570 unit tests and 22 blocking browser tests. The full agent-file scan and frozen install passed. The scanner also ran successfully on Node 20.17.
Isolated controls rejected a staged synthetic secret, a staged secret hidden by a clean working tree, and personal local settings. Clean input passed, and diagnostics did not echo the synthetic secret. Network access was denied for those controls.
The installed Darwin arm64 binary matched the registry and lockfile integrity. Other platform binaries were not independently executed. No deployment providers were contacted.
Regenerating from main with the declared pnpm 11.1 reproduced nearly all of the lockfile churn, so the contributor’s exact lockfile is preserved. This adds development tooling, with no runtime package source change.
Hosted checks and the normal Core review are still required before merge.

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.

2 participants