mirror of
https://github.com/trailofbits/skills.git
synced 2026-09-27 09:29:06 +00:00
gh-cli: intercept-github-curl.sh denies commands whose heredoc body mentions curl + a GitHub URL #333
Labels
No labels
blocked:CLA-unsigned
blocked ❌
bug 🐛
claude-code-assisted
component:CI/CD 🤖
component:documentation 📖
component:tests 🧪
dependencies
duplicate 👯
enhancement ✨
github_actions
good first issue
help wanted
invalid
no-version-bump
platform:linux 🐧
platform:macos 🍎
platform:windows 🪟
priority:high
priority:low
priority:medium
python
question ❓
security ⚠️
upstream 🔼
waiting-on-reporter 🕐
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
skills/trailofbits-skills#333
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Plugin:
gh-cli1.6.2,hooks/intercept-github-curl.sh(PreToolUse, matcherBash)What happens
The hook runs its two regexes over the whole
tool_input.commandstring. When a command writes a file through a heredoc, and the file content containscurlfollowed by a GitHub URL, the command gets denied even though it never runs curl.Minimal repro, as the command Claude Code sends to the Bash tool:
Result:
permissionDecision: denywithUse gh release download --repo aquasecurity/trivy instead. The command only writes a YAML file. The curl runs later, on a CI runner that has no authenticatedgh.The same happens for a commit message that mentions one:
git commit -m 'docs: replace curl https://api.github.com/repos/o/r with gh api'is denied.(A single-quoted
'curl ...that starts right after the quote passes, because the anchor requires whitespace beforecurl.)Why it matters
The deny message names neither the plugin nor the script. Tracking it down took a grep under
~/.claude/plugins/cache/.Possible fix
Before matching, drop heredoc bodies and quoted strings, the same way
(^|[[:space:];|&])(curl|wget)[[:space:]]already tries to anchor on a command position. A minimal version strips everything after the first<<delimiter up to the matching terminator. A fuller version checks only the command word of each;/&&/||/|segment. The deny reason could also start withgh-cli plugin:so a user can find the source.Happy to test a patch against the case above.