diff --git a/dot_claude/settings.json b/dot_claude/settings.json index b50a9b9..3d31004 100644 --- a/dot_claude/settings.json +++ b/dot_claude/settings.json @@ -18,7 +18,7 @@ "hooks": [ { "type": "command", - "command": "grep -q '\"dangerouslyDisableSandbox\"[[:space:]]*:[[:space:]]*true' && echo '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"ask\",\"permissionDecisionReason\":\"サンドボックス外での実行には承認が必要です\"}}'; exit 0", + "command": "input=$(cat); cmd=$(printf '%s' \"$input\" | jq -r '.tool_input.command // \"\"'); flag=$(printf '%s' \"$input\" | jq -r '.tool_input.dangerouslyDisableSandbox // false'); danger=false; [ \"$flag\" = \"true\" ] && danger=true; printf '%s' \"$cmd\" | grep -Eq '(^|[[:space:]])(--upload-pack|--receive-pack|--exec-path)(=|[[:space:]]|$)' && danger=true; printf '%s' \"$cmd\" | grep -Eq '(^|[[:space:]])(GIT_SSH_COMMAND=|GIT_CONFIG_[A-Za-z_]*=)' && danger=true; if printf '%s' \"$cmd\" | grep -Eq '(^|[[:space:]])git([[:space:]]|$)' && printf '%s' \"$cmd\" | grep -Eq '(^|[[:space:]])(-c|-C)([[:space:]]|=|$)'; then danger=true; fi; if [ \"$danger\" = \"true\" ]; then printf '%s' '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"ask\",\"permissionDecisionReason\":\"サンドボックス外実行またはgitの危険なグローバルオプション使用には承認が必要です\"}}'; fi; exit 0", "timeout": 10, "statusMessage": "sandbox-escape-gate" } @@ -28,7 +28,29 @@ }, "permissions": { "allow": [ - "Bash(git *)", + "Bash(git status)", + "Bash(git status *)", + "Bash(git log)", + "Bash(git log *)", + "Bash(git diff)", + "Bash(git diff *)", + "Bash(git show *)", + "Bash(git branch)", + "Bash(git branch *)", + "Bash(git remote -v)", + "Bash(git fetch)", + "Bash(git fetch *)", + "Bash(git pull)", + "Bash(git pull *)", + "Bash(git add *)", + "Bash(git commit *)", + "Bash(git push)", + "Bash(git checkout *)", + "Bash(git switch *)", + "Bash(git stash*)", + "Bash(git tag*)", + "Bash(git rev-parse *)", + "Bash(git blame *)", "WebFetch(domain:github.com)", "WebFetch(domain:api.github.com)", "WebFetch(domain:raw.githubusercontent.com)", @@ -69,7 +91,12 @@ "Bash(git push --force *)", "Bash(git push -f *)", "Bash(git reset --hard *)", - "Bash(git clean -f *)" + "Bash(git clean -f *)", + "Bash(git * --upload-pack*)", + "Bash(git * --receive-pack*)", + "Bash(git * --exec-path*)", + "Bash(git -c *)", + "Bash(git -C *)" ] }, "sandbox": { @@ -96,7 +123,14 @@ "~/.netrc", "~/.config/gcloud/", "~/.config/gh/", - "~/.kube/" + "~/.kube/", + "**/.env", + "**/.env.*", + "**/.envrc", + "**/secrets/**", + "**/credentials", + "**/*.pem", + "**/*.key" ], "allowWrite": [ "~/.npm",