Skip to content

Commit c5757aa

Browse files
stranmaclaude
andcommitted
fix: address CodeRabbit round 2 feedback
- Move gh pr close from allow to ask (remote state change) - Move git push from allow to ask (remote state change); force variants stay in deny as a hard block - This prevents force-push bypass via flag ordering variants like git push --force-with-lease or git push -u -f Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent c3a84e5 commit c5757aa

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

.claude/settings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Bash(uv run pyright *)",
77
"Bash(uv add *)", "Bash(uv pip *)", "Bash(uv venv *)",
88
"Bash(uv lock *)", "Bash(uv tree *)", "Bash(uv export *)",
9-
"Bash(git add *)", "Bash(git commit *)", "Bash(git push *)",
9+
"Bash(git add *)", "Bash(git commit *)",
1010
"Bash(git fetch *)", "Bash(git pull *)", "Bash(git rebase *)",
1111
"Bash(git branch *)", "Bash(git checkout *)", "Bash(git status *)",
1212
"Bash(git diff *)", "Bash(git log *)", "Bash(git show *)",
@@ -19,7 +19,6 @@
1919
"Bash(git describe *)", "Bash(git shortlog *)", "Bash(git rev-list *)",
2020
"Bash(gh pr create *)", "Bash(gh pr view *)", "Bash(gh pr list *)",
2121
"Bash(gh pr checks *)", "Bash(gh pr diff *)", "Bash(gh pr edit *)",
22-
"Bash(gh pr close *)",
2322
"Bash(gh run list *)", "Bash(gh run view *)", "Bash(gh run watch *)",
2423
"Bash(gh issue list *)", "Bash(gh issue view *)",
2524
"Bash(gh repo view *)", "Bash(gh release list *)", "Bash(gh release view *)",
@@ -41,12 +40,13 @@
4140
"ask": [
4241
"Bash(python *)", "Bash(uv run python *)",
4342
"Bash(docker *)", "Bash(docker-compose *)", "Bash(terraform *)",
44-
"Bash(gh pr merge *)", "Bash(gh pr reopen *)", "Bash(gh pr comment *)",
43+
"Bash(gh pr merge *)", "Bash(gh pr reopen *)", "Bash(gh pr close *)", "Bash(gh pr comment *)",
4544
"Bash(gh pr review *)", "Bash(gh pr ready *)", "Bash(gh workflow run *)",
4645
"Bash(gh workflow enable *)", "Bash(gh workflow disable *)",
4746
"Bash(gh api *)",
4847
"Bash(gh issue create *)", "Bash(gh issue comment *)",
4948
"Bash(gh issue close *)", "Bash(gh issue edit *)",
49+
"Bash(git push *)",
5050
"Bash(git init *)", "Bash(git clone *)",
5151
"Bash(uv remove *)", "Bash(uv cache *)", "Bash(uv init *)",
5252
"WebFetch"

tests/test_permissions.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,13 @@ def test_git_read_operations_are_allowed(self, settings: dict[str, Any]) -> None
416416
assert evaluate(f"Bash({cmd})", settings) == "allow", f"{cmd} should be allowed"
417417

418418
def test_git_write_operations_are_allowed(self, settings: dict[str, Any]) -> None:
419-
for cmd in ["git add .", 'git commit -m "msg"', "git push origin main"]:
419+
for cmd in ["git add .", 'git commit -m "msg"']:
420420
assert evaluate(f"Bash({cmd})", settings) == "allow", f"{cmd} should be allowed"
421421

422+
def test_git_push_requires_confirmation(self, settings: dict[str, Any]) -> None:
423+
"""git push affects remote state -- requires confirmation."""
424+
assert evaluate("Bash(git push origin main)", settings) == "ask"
425+
422426
def test_testing_commands_are_allowed(self, settings: dict[str, Any]) -> None:
423427
for cmd in ["pytest tests/", "uv run pytest -v"]:
424428
assert evaluate(f"Bash({cmd})", settings) == "allow", f"{cmd} should be allowed"

0 commit comments

Comments
 (0)