Skip to content

guardrails: block-convention-violation.sh has the same alias-chain re-expansion fail-open fixed for the other two guards in #964 #1089

Closed

Description

@kyle-sexton

Origin

Found by the #964 fixer during implementation (PR #1085). The third guardrails hook plugins/guardrails/hooks/block-convention-violation.sh (CC-layer commit-subject/PR-title content gate, shipped in #1071) contains the IDENTICAL defect pair fixed in the other two guards by #1085:

  1. Re-expansion splice ${w[@]:0:gi+1} drops command-line -c/--config/--config-env globals from nested re-parses — inline-alias branch (~L289-307) and persisted-gitconfig-alias branch (~L308-326).
  2. HOOK_NO_ALIAS one-level cap on the false premise git does not chain aliases.

Repro

git -c alias.c=x -c alias.x='commit -m "bad subject"' c — chained alias smuggles a convention-violating subject past the gate (gate exits 0 where a direct git commit -m would exit 2).

Severity / defer classification (tower)

Deferrable — NOT in the defer-forbidden carve-out: this gate enforces an opt-in commit-subject/PR-title regex convention ("UNRESOLVED = NO ENFORCEMENT" is its documented default), not data-loss protection, not a safety/merge gate, not a security control. Fail-open here means a convention slips through, which is reversible (amend/retitle) and caught downstream by the PR-title CI check. Materially lower blast radius than #964's two guards.

Fix direction

Either (a) port #1085's two changes verbatim (splice ${w[@]:0:sub_idx} + HOOK_ALIAS_SEEN save/restore seen-set), or preferably (b) fold into the SSOT extraction of the alias re-expansion logic to a shared lib — rejected for #964 as wrong pre-freeze tradeoff (brief comment on #964, id 5049748321) but correct long-term, and a third copy of the logic strengthens that case.

Links

Activity

  1. added
    needs-triage
    on Jul 22, 2026
  2. added
    status: ready
    and removed
    needs-triage
    on Jul 22, 2026
  3. added theissue type on Jul 22, 2026
  4. kyle-sexton commented on Jul 22, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Triage — routing between the two fix directions. Option (b), folding the alias re-expansion logic into a shared SSOT lib, was already explicitly rejected as the wrong pre-freeze tradeoff for #964 (same two guards this issue's fix pattern comes from) — that reasoning applies identically here; a third copy strengthens the case for the eventual SSOT extraction but doesn't change the near-term call.

    Decision defaulted: port #1085's two changes verbatim to block-convention-violation.sh (splice ${w[@]:0:sub_idx} + HOOK_ALIAS_SEEN save/restore) — veto before merge. The SSOT extraction stays a tracked future improvement, not blocking this fix. Routed status: ready on this basis.

  5. added
    needs-human
    on Jul 23, 2026
  6. kyle-sexton commented on Aug 12, 2026

    @kyle-sexton
    MemberAuthor

    Closing as fixed on main.

    Evidence: block-convention-violation.sh now splices alias argv through sub_idx (indices 0..sub_idx), matching block-dangerous-git's carry of command-line globals into each hop.

    Parent umbrella #1085 and #2166 are already closed; this was the remaining convention-violation-specific tracking issue.

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

    needs-humanstatus: ready

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions