Harden git hook matchers against -C bypass #1

Merged
fragmented merged 1 commit from harden-git-hook-matchers into mainline 2026-07-27 07:53:50 +00:00
Owner

The three git-triggered PreToolUse hooks anchored on git <flags> <verb>, so the git -C <path> <verb> form (and -c, --git-dir,
--work-tree) slipped past every matcher. History rewrites and
worktree creation went ungated and the decision nudge never fired
whenever git ran with a global option.

Add a shared prefix that consumes git's global options before the
subcommand, so the flag forms match like the bare command. While
here, inject-operating-standards now skips read-only queries and bare
branch/tag/remote/worktree listings instead of over-firing on them,
and nudge-decision-on-commit no longer false-matches commit-tree.

Verified with a 48-case matcher suite, all passing. Design notes for
operating-standards, the bootstrap plan, and decision-engine record
the normalization and the wider read-only skip.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

The three git-triggered PreToolUse hooks anchored on `git <flags> <verb>`, so the `git -C <path> <verb>` form (and `-c`, `--git-dir`, `--work-tree`) slipped past every matcher. History rewrites and worktree creation went ungated and the decision nudge never fired whenever git ran with a global option. Add a shared prefix that consumes git's global options before the subcommand, so the flag forms match like the bare command. While here, inject-operating-standards now skips read-only queries and bare branch/tag/remote/worktree listings instead of over-firing on them, and nudge-decision-on-commit no longer false-matches commit-tree. Verified with a 48-case matcher suite, all passing. Design notes for operating-standards, the bootstrap plan, and decision-engine record the normalization and the wider read-only skip. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The three git-triggered PreToolUse hooks anchored on `git <flags>
<verb>`, so the `git -C <path> <verb>` form (and `-c`, `--git-dir`,
`--work-tree`) slipped past every matcher. History rewrites and
worktree creation went ungated and the decision nudge never fired
whenever git ran with a global option.

Add a shared prefix that consumes git's global options before the
subcommand, so the flag forms match like the bare command. While
here, inject-operating-standards now skips read-only queries and bare
branch/tag/remote/worktree listings instead of over-firing on them,
and nudge-decision-on-commit no longer false-matches commit-tree.

Verified with a 48-case matcher suite, all passing. Design notes for
operating-standards, the bootstrap plan, and decision-engine record
the normalization and the wider read-only skip.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fragmented merged commit 69fef623db into mainline 2026-07-27 07:53:50 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
agentic/fragmented-marketplace!1
No description provided.