Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/claude-implement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
claude_args: |
--max-turns 150
--model claude-sonnet-5
--allowedTools "Bash(pnpm install:*),Bash(pnpm run:*),Bash(pnpm test:*),Bash(pnpm exec:*),Bash(pnpm --filter:*),Bash(pnpm ls:*),Bash(pnpm why:*),Bash(node:*),Bash(git status:*),Bash(git diff:*),Bash(git log:*),Bash(git show:*),Bash(mkdir:*),Bash(gh issue view:*),Bash(gh issue comment:*),Bash(gh pr create:*),Bash(gh pr view:*),Bash(gh pr edit:*),Bash(gh pr diff:*),Bash(gh pr checks:*)"
--allowedTools "Bash(pnpm install:*),Bash(pnpm run:*),Bash(pnpm test:*),Bash(pnpm exec:*),Bash(pnpm --filter:*),Bash(pnpm ls:*),Bash(pnpm why:*),Bash(node:*),Bash(git status:*),Bash(git diff:*),Bash(git log:*),Bash(git show:*),Bash(git checkout:*),Bash(git switch:*),Bash(git branch:*),Bash(git add:*),Bash(git commit:*),Bash(git push:*),Bash(git config:*),Bash(mkdir:*),Bash(gh issue view:*),Bash(gh issue comment:*),Bash(gh pr create:*),Bash(gh pr view:*),Bash(gh pr edit:*),Bash(gh pr diff:*),Bash(gh pr checks:*)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does claude-code-action support a disallowedTools or deny-rule input alongside --allowedTools?

💡 Result:

Yes, claude-code-action supports the use of both --allowedTools and --disallowedTools [1][2]. You can pass these flags through the claude_args input in your GitHub Actions workflow configuration [1][2]. The claude_args parameter is designed to accept any valid Claude Code CLI arguments [1][2]. Example usage in a GitHub Action: - uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} claude_args: "--allowedTools Read,Grep --disallowedTools Bash" Key behaviors for these tools include: - Both flags accept the same rule format, such as ToolName(specifier) [3]. - If both --allowedTools and --disallowedTools are set, --disallowedTools takes precedence; if a tool is listed in both, it is removed [3]. - Deny rules (via --disallowedTools) are restrictive and cannot be overridden by allow rules [4]. For example, a tool denied at any configuration level (including managed settings) cannot be re-allowed by the CLI flag [4].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the workflow around the referenced line
file=".github/workflows/claude-implement.yml"
wc -l "$file"
sed -n '1,220p' "$file" | cat -n

# Look for other git-related tool allowances or signs this flow needs write/config access
rg -n "git (push|config|branch|checkout|switch|add|commit|diff|status|show|log)" .github/workflows . -g '!**/node_modules/**' || true

Repository: allxsmith/bestax

Length of output: 14202


🌐 Web query:

claude-code-action disallowedTools precedence allowedTools deny rules git push git config CLI arguments

💡 Result:

In Claude Code, permission rules are evaluated in a strict order: deny, then ask, then allow [1][2]. A deny rule at any scope (user, project, or CLI) takes precedence and cannot be overridden by an allow rule at another scope or the same scope [1][2]. Regarding tool configuration and precedence: 1. Settings Precedence: Configuration follows a hierarchy where managed settings cannot be overridden, followed by CLI arguments (temporary session overrides), local project settings (.claude/settings.local.json), shared project settings (.claude/settings.json), and finally user settings (~/.claude/settings.json) [1][2]. 2. Deny Rules: A broader deny rule (e.g., Bash(aws *)) blocks all matching calls, including those that might otherwise be matched by a narrower allow rule [1][2]. 3. AllowedTools vs. DisallowedTools: - --allowedTools (whitelist) pre-approves tools. If a tool is not in the allowlist, it falls through to the configured permission mode [3]. - --disallowedTools (blacklist) removes tool definitions from the request entirely, meaning Claude cannot see or attempt them [3]. Disallowed tools cannot be re-enabled by allow rules [1][2]. 4. Git Push and CLI Arguments: - Claude Code contains an undocumented, harness-level safety guard that blocks assistant-initiated git push to the default branch [4]. This guard acts independently of standard permission rules, meaning it can fire even if Bash(git push *) is explicitly allowed in settings [4]. - CLI arguments like --allowedTools, --disallowedTools, and --permission-mode provide temporary overrides for the current session [1][5]. Note that --allowedTools may appear to be ignored if using --permission-mode bypassPermissions, as the latter bypasses standard permission checks [6]. To manage Git or other sensitive operations, it is recommended to use specific deny rules to refine broader allow rules (e.g., allowing Bash(git *) while denying Bash(git push --force *)) [7]. Since there is no documented opt-out for the default-branch push guard, it remains active by default [4].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Lightweight read-only check for the Claude Code Action docs via web lookup is not available in-shell,
# so inspect repository references only.
rg -n "claude-implement|claude_args|allowedTools|disallowedTools|ssh_signing_key|git config" .github README* docs* . -g '!**/node_modules/**' || true

Repository: allxsmith/bestax

Length of output: 2871


Narrow the git tool permissions. Bash(git push:*), Bash(git branch:*), and Bash(git config:*) are prefix-based, so this still allows force-pushes, branch deletion/renames, and arbitrary config writes. claude-code-action supports --disallowedTools, so deny the dangerous subcommands explicitly and drop git config if this flow doesn’t need it.

🤖 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 @.github/workflows/claude-implement.yml at line 109, The allowedTools list in
claude-implement workflow is still too broad because the git prefixes permit
dangerous subcommands. Update the tool policy around the allowedTools entry to
narrow git usage by removing unnecessary git config access and explicitly
blocking unsafe subcommands through --disallowedTools, especially any
force-push, branch deletion/rename, and config-write operations. Keep the
existing git-related symbols in the workflow, but tighten them so only the
minimal safe git commands needed by claude-code-action remain available.

prompt: |
REPO: ${{ github.repository }}
ISSUE NUMBER: ${{ github.event.issue.number }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/claude-pr-loop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ jobs:
claude_args: |
--max-turns 80
--model claude-sonnet-5
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(pnpm install:*),Bash(pnpm run:*),Bash(pnpm test:*),Bash(pnpm exec:*),Bash(pnpm --filter:*),Bash(node:*),Bash(git status:*),Bash(git diff:*),Bash(git log:*),Bash(git show:*),Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh pr checks:*),Bash(gh pr comment:*),Bash(gh api:*)"
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(pnpm install:*),Bash(pnpm run:*),Bash(pnpm test:*),Bash(pnpm exec:*),Bash(pnpm --filter:*),Bash(node:*),Bash(git status:*),Bash(git diff:*),Bash(git log:*),Bash(git show:*),Bash(git checkout:*),Bash(git switch:*),Bash(git branch:*),Bash(git add:*),Bash(git commit:*),Bash(git push:*),Bash(git config:*),Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh pr checks:*),Bash(gh pr comment:*),Bash(gh api:*)"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the workflow files and nearby references.
git ls-files '.github/workflows/*' | sed -n '1,120p'

echo '--- claude-pr-loop.yml matches ---'
rg -n 'allowedTools|git push|git config|git branch|UNTRUSTED DATA|never push to main|main' .github/workflows/claude-pr-loop.yml

echo '--- claude-implement.yml matches ---'
rg -n 'allowedTools|git push|git config|git branch|UNTRUSTED DATA|never push to main|main' .github/workflows/claude-implement.yml

echo '--- surrounding context in claude-pr-loop.yml ---'
sed -n '300,380p' .github/workflows/claude-pr-loop.yml

echo '--- surrounding context in claude-implement.yml ---'
sed -n '300,380p' .github/workflows/claude-implement.yml

Repository: allxsmith/bestax

Length of output: 7150


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- claude-implement.yml around the allowlist ---'
sed -n '90,190p' .github/workflows/claude-implement.yml

echo '--- claude-pr-loop.yml around the allowlist ---'
sed -n '330,380p' .github/workflows/claude-pr-loop.yml

Repository: allxsmith/bestax

Length of output: 10182


Tighten the git allowlist in .github/workflows/claude-pr-loop.yml:345

Bash(git push:*) and Bash(git branch:*) still allow destructive flags like --force, delete, and rename, and Bash(git config:*) grants arbitrary repo-local config writes. The prompt text is not an enforcement boundary, so narrow these to the exact subcommands/flags needed or drop the write-capable git tools if they aren’t required.

🤖 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 @.github/workflows/claude-pr-loop.yml at line 345, The allowedTools list in
the claude-pr-loop workflow is still too broad for git operations. Tighten the
entries for git in the prompt/tool allowlist by removing or narrowing `git
push`, `git branch`, and `git config` so only the exact safe subcommands and
flags needed by the workflow are permitted. Update the allowlist near the
`allowedTools` configuration to avoid granting write-capable or destructive git
access unless it is strictly required.

prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ needs.gate.outputs.pr }}
Expand Down
Loading