Skip to content

fix: quote --allowedTools in issue-triage workflow#905

Merged
stack72 merged 1 commit intomainfrom
fix/issue-triage-allowedtools-quoting
Mar 28, 2026
Merged

fix: quote --allowedTools in issue-triage workflow#905
stack72 merged 1 commit intomainfrom
fix/issue-triage-allowedtools-quoting

Conversation

@keeb
Copy link
Copy Markdown
Contributor

@keeb keeb commented Mar 28, 2026

Summary

  • Fix /triage command failure caused by shell-quote parsing of unquoted Bash(...) patterns in claude_args
  • Wraps the --allowedTools value in single quotes so spaces and parentheses are preserved as a single token

Root Cause

claude-code-action uses shell-quote to parse claude_args. The Bash(...) patterns added in #852 contain spaces (e.g. Bash(gh api --method POST:*/reactions)), which caused:

  1. Parentheses treated as shell operators and stripped
  2. Space-splitting broke patterns into separate tokens
  3. --method parsed as a standalone CLI flag, corrupting the entire argument structure
  4. Claude Code crashed with exit code 1

Confirmed by workflow logs from the failed #902 triage — allowed tools were ["Read", "Glob", "Grep", "Bash", "gh", "issue", "api"] instead of the intended patterns.

Fixes #904

Test plan

🤖 Generated with Claude Code

… parsing

The claude-code-action uses shell-quote to parse claude_args. The
Bash(...) patterns containing spaces (e.g. `Bash(gh api --method
POST:*/reactions)`) were being split into separate tokens, causing
parentheses to be stripped as shell operators and `--method` to be
parsed as a standalone CLI flag. This corrupted the argument structure
and caused Claude Code to exit with code 1.

Wrapping the value in single quotes preserves it as a single token
through shell-quote parsing.

Fixes #904

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code Review

Blocking Issues

None.

Suggestions

None.

Clean, well-scoped fix. The single-quote wrapping correctly preserves the Bash(...) patterns as a single token when shell-quote parses claude_args. The root cause analysis is thorough and the fix directly addresses the parsing issue that caused the triage failure.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

CI Security Review

Critical / High

None.

Medium

  1. anthropics/claude-code-action@v1 not pinned to SHA (.github/workflows/issue-triage.yml:56): Third-party actions should be pinned to a full commit SHA to prevent supply chain attacks via tag mutation. While Anthropic is a trusted publisher, best practice is SHA pinning for all non-GitHub-owned actions. Pre-existing issue, not introduced by this PR.

Low

None.

Verdict

PASS — This change is a security improvement. The previous unquoted --allowedTools value was being parsed incorrectly by shell-quote, resulting in the LLM receiving an unrestricted Bash tool instead of the intended scoped Bash(gh issue view:*) / Bash(gh issue comment:*) / Bash(gh api --method POST:*) / Bash(gh api --method PATCH:*) patterns. The single-quote fix ensures the tool restrictions are properly enforced.

Pre-existing security posture review (not blocking):

  • ✅ Prompt injection: Issue content is fetched by the LLM via tool calls, not interpolated into the prompt. Security preamble is present.
  • ✅ Expression injection: Only numeric values (issue.number, comment.id) and repo name are interpolated in run: blocks.
  • ✅ Trigger safety: issue_comment trigger is gated to OWNER/MEMBER/COLLABORATOR via author_association check.
  • ✅ Permissions: Minimal (contents: read, issues: write), appropriate for a single-job workflow.
  • ✅ Tool scoping: Allowed tools are tightly scoped to issue view/comment and specific API method+path patterns.
  • ⚠️ SHA pinning: anthropics/claude-code-action@v1 should be pinned to a commit SHA (medium, pre-existing).

@stack72 stack72 merged commit 2b1e403 into main Mar 28, 2026
11 checks passed
@stack72 stack72 deleted the fix/issue-triage-allowedtools-quoting branch March 28, 2026 16:51
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.

fix: issue-triage workflow fails due to shell-quote parsing of --allowedTools

2 participants