Skip to content

guardrails: block-noncanonical-commit file-based alias resolution misses alias.<name>.command subkey (git config --get returns empty) #1022

Description

@kyle-sexton

Found during the PR #903 .command subkey fix round (adjacent, pre-existing, left out of that surgical scope).

block-noncanonical-commit.sh:261 resolves file-based aliases via git config --get alias.$sub, which returns empty for a file-based alias.<name>.command definition — yet git (verified 2.54.0.windows.1) honors the .command subkey as an alias. A commit-bypassing alias written to config via the subkey spelling is therefore not resolved and not checked.

Class: under-detection (fail-open) in a security guard, BUT the threat model requires a prior git-config WRITE (config-file mutation), unlike the command-line -c/--config-env injection the #903 fix closed — narrower exposure, config-write paths have their own guard surface.

Fix direction: resolve both spellings — git config --get alias.$sub OR git config --get alias.$sub.command (last-wins semantics across the two spellings match git's behavior, verified empirically in the #903 fix round; see the cross-form last-wins tests added to lib/hook-utils.test.sh).

Origin: fixer round on PR #903, 2026-07-22.

Activity

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-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.priority: mediumReal value, no hard deadline; normal backlog flow.status: readyTriaged, unblocked, and fully specified; eligible to pick up.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions