Skip to content

fix(pre-tool-scope-guard): apply quote-strip to all destructive-command checks (v6.1.4)#48

Merged
intel352 merged 1 commit into
mainfrom
fix/force-push-regex-quote-strip-2026-05-28T0217
May 28, 2026
Merged

fix(pre-tool-scope-guard): apply quote-strip to all destructive-command checks (v6.1.4)#48
intel352 merged 1 commit into
mainfrom
fix/force-push-regex-quote-strip-2026-05-28T0217

Conversation

@intel352
Copy link
Copy Markdown
Contributor

Summary

  • hooks/pre-tool-scope-guard: the force-push, history-rewrite, locked-plan-push, and default-branch-push checks now use cmd_no_quotes (the quote-stripped form already computed for the SUPERPOWERS_ self-bypass check). Previously they scanned the raw Bash command and produced false-positive blocks when a destructive command appeared as a documentation example inside a quoted heredoc body.
  • Real-world bite: the v6.1.3 release PR body quoted the force-push command verbatim as a changelog example, and the hook blocked the very PR meant to ship the v6.1.3 fix. Worked around that release with --body-file; this PR fixes the regex.
  • Same trade-off the SUPERPOWERS_ self-bypass check already accepts: a destructive command hidden inside quoted args (e.g. eval "...") would slip through. Acceptable edge case vs the much more common false-positive on PR bodies and inline documentation.
  • Added regression test in tests/hook-contracts.sh.

Test plan

  • tests/hook-contracts.sh — 50 assertions PASS, including the new false-positive regression
  • tests/version-check.sh — manifests agree on 6.1.4
  • Used as a real test of the marketplace auto-merge chain — after the enterprise ruleset tweak, this PR's release should flow through autonomous-dev-kit merge → v6.1.4 tag → marketplace bump PR → auto-merge with zero touches.

Release validation context

User adjusted the enterprise ruleset earlier this session to unblock marketplace auto-merge. This is the first release after that tweak; the cascade is a test of whether the chain now completes end-to-end without admin override.

🤖 Generated with Claude Code

…nd checks (v6.1.4)

The force-push, history-rewrite, locked-plan-push, and default-branch-push
checks were scanning the raw tool_input.command instead of the quote-stripped
cmd_no_quotes form (which was already computed for the SUPERPOWERS_ self-
bypass detector). The SUPERPOWERS_ check was correct; the four destructive-
command checks were not.

Real-world false positive encountered during v6.1.3 release: the PR body
heredoc for PR #47 quoted the force-push command verbatim as an example in
the changelog text. The hook scanned the full Bash command (including the
--body arg) and matched the example as a real force push, blocking the
very PR meant to ship the v6.1.3 fix. Worked around with --body-file that
release. Now fixed at the regex level.

Trade-off: an attacker who hides a destructive command inside quoted args
would slip through quote-strip. Acceptable edge case vs the much more
common false-positive on PR bodies and inline documentation. Same trade-off
the SUPERPOWERS_ check already accepted.

Added regression test in tests/hook-contracts.sh that asserts no block
fires when force-push appears inside a quoted string.

Version bump 6.1.3 -> 6.1.4 across all four manifests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@intel352 intel352 enabled auto-merge (squash) May 28, 2026 02:21
@intel352 intel352 disabled auto-merge May 28, 2026 02:25
@intel352 intel352 merged commit 221a95e into main May 28, 2026
5 checks passed
@intel352 intel352 deleted the fix/force-push-regex-quote-strip-2026-05-28T0217 branch May 28, 2026 02:25
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.

1 participant