Skip to content

fix(guardrails): treat a word-continuing ( as a word character in the top-level segmenter #12360

Closed

Description

@kyle-sexton

Problem

The guardrails top-level command parser in plugins/guardrails/lib/hook-utils.sh (shared copies) splits a word-continuing ( (an array assignment such as a=(...) or an extglob such as @(...)) as if it were a subshell, then reads a # after the closing ) as the start of a comment. Bash does not: after a=(x) the # is literal when it continues the word. A destructive git command placed after such a construct can then be hidden from the dangerous-git guard at top level.

#12354 (the heredoc-body substitution scanner for #6730) makes the body scanner's verdict equal the top-level verdict for these forms and adds parity rows to run-guards.test.sh, so the remaining miss is in the top-level parser on main.

Fix

Treat a ( that continues a word as a word character in the top-level segmenter: no subshell frame and no comment start after its ). Add blocked rows to block-dangerous-git for the array-assignment and extglob forms.

Verification

The new rows fail on main and pass after the fix; block-dangerous-git, run-guards and lib/hook-utils.test stay green; sync-shared-copies --check is clean.

Related

Refs: #6730, #12354.

Activity

  1. added
    needs-triage
    on Nov 2, 2026
  2. github-actions commented on Nov 2, 2026

    @github-actions
    Contributor

    Proposed work class: work-class: scoped
    Basis: automated intake triage; the lanes App applied this class.

    Size: Small
    Complexity: Medium
    Uncertainty: Known
    Flags: none
    Blocked by: none

    Understood: the top-level command segmenter in the guardrails shared hook-utils.sh treats a word-continuing ( (array assignment or extglob) as a subshell. It then reads a # after the closing ) as a comment, which can hide a later destructive git command from the dangerous-git guard. The fix is to treat that ( as a word character and add blocked rows to block-dangerous-git. The done-when is exact. No duplicates found among the open issues.

    Automated triage, applied by the lanes App.

  3. added and removed
    needs-triage
    on Nov 2, 2026
  4. added
    status: ready
    on Nov 2, 2026
  5. added
    status: confirmed
    and removed
    status: ready
    on Nov 2, 2026
  6. melodic-automation-lanes commented on Nov 2, 2026

    @melodic-automation-lanes
    Contributor

    Not admitted to the issue lane: no trusted-human acceptance criteria: a listed human must put the confirmed - [ ] criteria in the body or post them as their own comment, or, on an issue a listed human filed, intake's newest refinement comment must hold them unedited. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).

  7. melodic-automation-lanes commented on Nov 2, 2026

    @melodic-automation-lanes
    Contributor

    The latest triage verdict holds nothing: the issue is at status: ready.

  8. added
    needs-triage
    and removed
    status: confirmed
    on Nov 2, 2026
  9. 25 remaining items

  10. github-actions commented on Nov 2, 2026

    @github-actions
    Contributor
    No description provided.
  11. melodic-automation-lanes commented on Nov 2, 2026

    @melodic-automation-lanes
    Contributor

    The work-resolve-issue lane stopped on this issue (already-done): the run found the issue's work already on the default branch at a commit it cites, so the issue closes.
    Its reason cites no pull request merged into the default branch, or commit on it, made after the issue opened whose commit message closes this issue, so it retries instead of closing.
    It keeps agent-ready, and work-unblock starts it again (retry 1 of 2).

    In the run's words:

    already-done: merged pull request #12384 (merge commit 019478d) delivers #12360. Its body lists #12360 under Refs, and main at 0cd1cf1 already holds the fix, the blocked rows and the parse-segments cases this issue asks for.

    What the run says it did not do:

    • Did not run block-dangerous-git.test.sh, run-guards.test.sh or lib/hook-utils.test.sh. This lane may not run test scripts directly, and the suites passed in PR #12384's CI (90 checks passed).
    • Skipped tidy, review, verify and the PR prep: the work tree has no change.

    Run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41546053445

  12. added
    agent-ready
    and removed
    agent-ready
    on Nov 2, 2026
  13. github-actions commented on Nov 2, 2026

    @github-actions
    Contributor
    No description provided.
  14. github-actions commented on Nov 2, 2026

    @github-actions
    Contributor
    No description provided.
  15. melodic-automation-lanes commented on Nov 2, 2026

    @melodic-automation-lanes
    Contributor

    The work-resolve-issue lane stopped on this issue (already-done): the run found the issue's work already on the default branch at a commit it cites, so the issue closes.
    Its reason cites no pull request merged into the default branch, or commit on it, made after the issue opened whose commit message closes this issue, so it retries instead of closing.
    It keeps agent-ready, and work-unblock starts it again (retry 2 of 2).

    In the run's words:

    already-done: merged pull request #12384 (merge commit 019478d) delivered this issue's parser work. It replaced the closed #12361, which had been opened for #12360, and lists #12360 under Related instead of closing it. The default branch at 3b9363c already carries the fix and every test row the issue asks for.

    What the run says it did not do:

    • Did not run block-dangerous-git.test.sh, run-guards.test.sh or lib/hook-utils.test.sh: this lane cannot run a test runner directly, and the tests are unchanged on main. CI ran them when #12384 merged.
    • The repository is a shallow clone, so git could not trace the rows to #12384's merge commit. The merge SHA comes from the GitHub PR page, not from local history.
    • Skipped tidy, review, verify and checks prep: there is no diff to tidy or review.

    Run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41547224064

  16. added
    agent-ready
    and removed
    agent-ready
    on Nov 2, 2026
  17. github-actions commented on Nov 2, 2026

    @github-actions
    Contributor
    No description provided.
  18. github-actions commented on Nov 2, 2026

    @github-actions
    Contributor
    No description provided.
  19. melodic-automation-lanes commented on Nov 2, 2026

    @melodic-automation-lanes
    Contributor

    The work-resolve-issue lane stopped on this issue (already-done): the lane has retried this issue as many times as limits.stop-retries, or the stop's own row, allows.
    Its reason cites no pull request merged into the default branch, or commit on it, made after the issue opened whose commit message closes this issue, so it retries instead of closing.
    It removed agent-ready and added no label.

    In the run's words:

    already-done: merged pull request #12384 (merge commit 019478d) already makes the top-level segmenter treat a word-continuing ( as part of the word and adds the issue's blocked rows; it is on the default branch at 591d521.

    What the run says it did not do:

    • Did not run block-dangerous-git.test.sh, run-guards.test.sh or lib/hook-utils.test.sh: this lane runs only the named wrappers. The suites ran in #12384's CI, where the PR page shows 90 checks passed.
    • tidy, review and verify skipped: there is no diff to tidy, review or build.

    Run: https://github.com/melodic-software/claude-code-plugins/actions/runs/41548366817

    To run it again, add agent-ready.

  20. removed
    agent-ready
    on Nov 2, 2026
  21. kyle-sexton commented on Nov 3, 2026

    @kyle-sexton
    MemberAuthor

    Delivered: closing as completed. Merged PR #12384 (019478d) makes the top-level segmenter treat a word-continuing ( as part of the word and adds the issue's blocked rows to block-dangerous-git (array assignment, extglob, extglob alternation, and three more forms); its CI ran the suites. The lane's own run stopped on already-done. Written by the issue-triage session.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: ready

    Type

    Fields

    Work status

    agent-ready

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions