anthropics / anthropics/claude-code-action

False positive multi-operation detection blocks valid bash commands (awk, python3 -c, Windows path pattern)

Open
#1,274 1 comment 0 reactions 0 assignees View on GitHub
area:permissions bug p2
Dominant language
TypeScript
Stars
8.9k
Forks
2.1k
Avg merge
3d 9h
Merged PRs (30d)
10

Description

## Description

The multi-operation safety detector incorrectly blocks several valid bash commands, causing Claude to exhaust all available turns and the job to be cancelled.

## Reproduction

Observed consistently on a PR review run using \`claude-code-action@v1.0.41\` on GitHub Enterprise Server.

**Bug 1 — \`awk\` with \`&&\` inside a pattern**

Claude used \`awk 'NR>=270 && NR<=310' file.js\` to read a line range. The \`&&\` inside the awk pattern was interpreted as command chaining and blocked.

\`\`\`
Error: This Bash command contains multiple operations. The following part
requires approval: awk 'NR>=270 && NR<=310' file.js
\`\`\`

**Bug 2 — \`python3 -c\` inline**

Claude used \`python3 -c "import sys, json..."\` to parse JSON. Also blocked as multiple operations.

\`\`\`
Error: This Bash command contains multiple operations. The following part
requires approval: python3 -c "import sys, json..."
\`\`\`

**Bug 3 — Windows path false positive**

A file path ending with \`0:\` (likely from a truncated \`NR<=230\`) was flagged as a Windows drive letter.

\`\`\`
Error: Claude requested permissions to write to .../0:, which contains
a suspicious Windows path pattern that requires manual approval.
\`\`\`

## Impact

All three blocks accumulate until turns are exhausted (80), and the job is cancelled with \`Error: The operation was canceled.\`

## Workaround

Instructing Claude via prompt to use \`sed -n 'X,Yp' file\` instead of \`awk 'NR>=X && NR<=Y' file\` avoids Bug 1 and likely Bug 3.

Contributor guide

Open the contributing guide

Research direction

No source file or test is named in the report; start by locating the multi-operation safety detector and reproducing the three commands. Done means safe awk and python3 -c commands are accepted, genuinely suspicious Windows paths remain blocked, and regression coverage verifies all three cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, python, typescript
Domain
cli, security, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.