Repository navigation
fix(claude): correct settings.json permissions and tighten gitignore - #108
Conversation
Fix six Bash allow entries using colon syntax (MCP format, not shell); expand deny list with 14 missing entries for destructive git ops, POST/PUT API calls, and rm variants; narrow Write/Edit wildcards to project paths; replace enumerated .claude/ subdir exclusions in .gitignore with a catch-all negation pattern that protects against future untracked files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR updates configuration files to refine Claude command permissions and git tracking rules. ChangesClaude Settings and Git Tracking Configuration
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.claude/settings.json (1)
19-29: 💤 Low valueWrite and Edit permissions allow creating untracked files in .claude/.
Lines 21 and 32 grant
Write(.claude/**)andEdit(.claude/**)permissions, allowing creation of any file under.claude/. However,.gitignore(lines 43-45 in that file) tracks only.claude/CLAUDE.mdand.claude/settings.json, leaving other files untracked. This could lead to unintended local state accumulation if Claude creates temporary or cache files in that directory.This may be intentional for transient state management, but consider whether tighter scoping (e.g.,
Write(.claude/CLAUDE.md),Write(.claude/settings.json)) would better align with the tracked file policy.Also applies to: 30-40
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.claude/settings.json around lines 19 - 29, The current permissions include broad rules Write(.claude/**) and Edit(.claude/**) which allow creating any file under .claude/, while .gitignore only tracks .claude/CLAUDE.md and .claude/settings.json; restrict these permissions by replacing the glob entries Write(.claude/**) and Edit(.claude/**) with explicit entries like Write(.claude/CLAUDE.md) and Write(.claude/settings.json) (and remove the broad .claude/** entries) so only the tracked files are writable, and mirror the same change for the duplicate block mentioned (lines 30-40) to avoid untracked temporary files being created.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.claude/settings.json:
- Line 4: The wildcard allow rule Bash(git *) is unsafe given the reported bug
where broad allow patterns can override deny rules; either pin the Claude Code
dependency to a release that includes the fix for issue `#26276` or replace the
broad rule with an explicit allow-list of safe git commands (e.g., Bash(git
pull), Bash(git fetch), Bash(git status)) and remove/limit the Bash(git *) entry
so the existing deny block that prevents destructive git operations (the deny
rules currently intended to block git reset/checkout/clean) can reliably take
effect.
---
Nitpick comments:
In @.claude/settings.json:
- Around line 19-29: The current permissions include broad rules
Write(.claude/**) and Edit(.claude/**) which allow creating any file under
.claude/, while .gitignore only tracks .claude/CLAUDE.md and
.claude/settings.json; restrict these permissions by replacing the glob entries
Write(.claude/**) and Edit(.claude/**) with explicit entries like
Write(.claude/CLAUDE.md) and Write(.claude/settings.json) (and remove the broad
.claude/** entries) so only the tracked files are writable, and mirror the same
change for the duplicate block mentioned (lines 30-40) to avoid untracked
temporary files being created.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a6ad663e-ff9d-4f3d-af38-d427d1873165
📒 Files selected for processing (2)
.claude/settings.json.gitignore
There was a problem hiding this comment.
Pull request overview
This PR updates the repository’s Claude Code configuration and repo ignore rules to make command permissions correctly match intended shells globs, tighten the denylist for destructive operations, scope file write/edit permissions, and simplify .claude/ ignore handling.
Changes:
- Fixes inert
Bash(tool:*)permission entries by switching to space-separated glob syntax (e.g.,Bash(git *)). - Expands deny rules for destructive
gitoperations and write-mutatinggh apimethods, and scopesWrite/Editpermissions to repo-relevant paths and file types. - Replaces enumerated
.claude/<subdir>/ignores with a safer catch-all.claude/*plus explicit negations for the tracked files.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.gitignore |
Tightens .claude/ ignore rules using a catch-all pattern with negations to keep only the desired tracked files. |
.claude/settings.json |
Corrects Bash allow glob syntax, scopes Write/Edit permissions, and extends deny rules for destructive operations. |
| "Bash(gh api -X POST*)", | ||
| "Bash(gh api --method POST*)", | ||
| "Bash(gh api -X PUT*)", | ||
| "Bash(gh api --method PUT*)", |
There was a problem hiding this comment.
Fixed in commit a68a325. Added 8 wildcard-middle deny patterns covering the flag-after-endpoint ordering: Bash(gh api * -X POST*), Bash(gh api * --method POST*), Bash(gh api * -X PUT*), Bash(gh api * --method PUT*), Bash(gh api * -X DELETE*), Bash(gh api * --method DELETE*), Bash(gh api * -X PATCH*), Bash(gh api * --method PATCH*). The original prefix-only patterns are retained to cover the flag-first ordering.
| "allow": [ | ||
| "Bash(git:*)", | ||
| "Bash(git *)", | ||
| "Bash(gh pr *)", |
There was a problem hiding this comment.
Fixed in commit a68a325. Replaced Bash(gh pr *) with four read-only subcommands: Bash(gh pr view*), Bash(gh pr list*), Bash(gh pr checks*), Bash(gh pr diff*). Write operations (gh pr merge, gh pr close, gh pr create, gh pr edit) are no longer covered by the allow list.
PR Review12 findings: 1 Critical, 4 Important, 4 Suggested, 3 Informational Critical (must fix before merge)
Important (should fix)
Suggested
SonarQube: 0 issues, 0 hotspots. CI: all passing. 🤖 Generated with Claude Code |
… permissions - Replace Bash(git *) with 21 explicit subcommand allow entries to eliminate allow/deny ordering ambiguity from Claude Code bug #26276 - Replace Bash(gh pr *) with 4 read-only subcommands; prevents unintended gh pr merge, close, and create operations - Remove Write(*.json) and Edit(*.json); all JSON targets are covered by path-scoped .github/**, docs/**, and .claude/** patterns - Add 8 wildcard-middle deny patterns for gh api <endpoint> -X METHOD flag orderings not caught by prefix-only deny patterns - Add Bash(rm -fr*) deny entry for the -fr flag-order variant - Add CHANGELOG entry documenting all permission changes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PR fix completeCommit: a68a325 Addressed all CodeRabbit and Copilot findings from the review:
CI is running. Pre-commit passed locally before push. |
|



Summary
This PR introduces
.claude/settings.json(a new file; no prior configuration existed on main) and corrects the.gitignorecatch-all for.claude/so thatCLAUDE.mdandsettings.jsonare tracked by git.Initial changes (original commits):
Bash(git:*),Bash(pre-commit:*),Bash(grep:*),Bash(find:*),Bash(ls:*),Bash(yamllint:*)) used MCP tool colon format instead of shell glob format; they were inert. Replaced with correct space-separated format (Bash(git *)etc.).git push,git reset,git checkout --,git restore,git clean), write-mutating gh API calls (-X POST/PUT/DELETE/PATCHin prefix position), destructive gh repo and release operations, andrmvariants.Write(*)andEdit(*)with 11 path-scoped patterns covering.github/**,docs/**,.claude/**, and named file extensions..claude/catch-all exclusion with.claude/*plus negations for!.claude/CLAUDE.mdand!.claude/settings.jsonso config files are tracked while transient subdirs remain excluded.Review-driven fixes (CodeRabbit + Copilot findings):
Bash(git *)allow entry with 21 explicit subcommand entries (git status,git diff,git add,git commit,git log,git fetch,git pull,git branch,git stash,git show,git rev-parse,git merge-base,git worktree,git tag,git describe,git blame,git ls-files,git remote,git config,git rebase,git apply) to eliminate allow/deny ordering ambiguity (Claude Code bug #26276).Bash(gh pr *)with four read-only subcommands (gh pr view*,gh pr list*,gh pr checks*,gh pr diff*) to prevent unintendedgh pr merge,gh pr close, andgh pr create.Write(*.json)andEdit(*.json); all legitimate JSON targets are covered by the path-scoped patterns.Bash(gh api * -X POST*)etc.) to block flag orderings where the HTTP method flag appears after the endpoint URL.Bash(rm -fr*)to cover the-frflag-order variant not covered byrm -r*orrm -f*.Test plan
trim whitespace,end of files,large files,merge conflicts,private key,TruffleHog,no-em-dash).claude/settings.jsonvalidates as well-formed JSON (python3 -m json.tool)Bash(git *)replaced with 21 explicit subcommand entries (no broad wildcard allow)Bash(gh pr *)replaced with 4 read-only subcommandsWrite(*.json)andEdit(*.json)removed; path-scoped patterns provide coverageBash(rm -fr*)deny entry added[Unreleased] ### Fixed.gitignorenegation pattern covers.claude/CLAUDE.mdand.claude/settings.jsonwhile excluding all other.claude/contentsGenerated with Claude Code