Repository navigation
fix(hooks): judge git argv instead of command substrings in guard-git - #194
Merged
Merged
Conversation
The guard-git parity gate compared dangerousGitCommand() (the destructive-argv table) against the whole shell hook, so the protected-branch and Conventional Commits rules had no TS oracle at all. The fixture also asserted 'allow' for a push to protected main, and the harness inherited GIT_BIGPOWERS_LAND, which turns the protected-branch block off. - Export evaluateBashCall(), the pure function the tool_call handler decides with, and probe that instead of the argv table alone. - Split the force-with-lease fixture row: feature/x allows, main blocks on the protected-branch rule. - Strip GIT_BIGPOWERS_LAND from the harness environment so the verdict cannot depend on the developer's shell. Refs BUG-2026-11-03-guard-normalize-parity-vacuous. Fixes verification-gates red on run 41657748958.
assert-epic-gate release requires a fresh specs/AUDIT_LATEST.md with a VERDICT line, and release-branch step 2a requires specs/security/REVIEW.md to match the branch diff. Both were absent/stale for this branch, so the release gate was red for reasons unrelated to the fix. - AUDIT_LATEST.md: full audit-code checklist, 2 stated waivers (evaluateBashCall length, omp-hooks.ts size — both pre-existing or judged clearer whole). - security/REVIEW.md: threat model for a shell-command deny-list, one documented medium residual (indirection bypass), no HIGH findings. Refs BUG-2026-11-03-guard-normalize-parity-vacuous.
|
🎉 This PR is included in version 2.91.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
7 tasks done
danielvm-git
added a commit
that referenced
this pull request
Nov 7, 2026
) * fix(tooling): name the ACTIVE_WORK trigger in version-gap check Story e83s05. Block semantics unchanged; JSON now carries trigger. * fix(release): mirror last_tag and stamp live skill counts Story e83s01. sync-version-mirrors writes release.last_tag; sync-skills stamps the skill count into package.json and mcp-server.js. * fix(cli): status counts only bigpowers-owned skill links Story e83s02. Foreign links are reported on a separate line. * fix(receipts): read cycle-time ledger and label sources honestly Story e83s03. Publishes source breakdown and a staleness flag. * docs(specs): refresh VISION criteria and re-baseline the catalog Story e83s04. Zero drift warnings against the new baseline. * docs(specs): mark e83 done and record gate decisions Epic e83 stories s01-s05 complete. * fix(ci): move drift-check python out of a heredoc that stalls check-catalog-drift.sh hung in the story-verify gate. Logic now lives in scripts/lib/check-catalog-drift.py; behaviour unchanged. * fix(ci): stop e83 story verify recursing into the gate The epic.yaml verify lines called run-story-verify.sh, so a done story re-entered the gate without end. Real checks now live in verify-e83.sh, and run-story-verify.sh rejects a self-referential verify. * fix(specs): make e83s04 task verifies runnable by the gate Task verify lines began with ! and were rejected as prose. * docs(specs): record story-verify recursion and green preflight * fix(e83): address review — enforceable negations, SKILL.md count, realpath Findings 1, 6, 8 of the independent review. Others are low severity and left. * fix(e83): resolve remaining review findings Receipts: per-row skip, tz-correct latest entry, backfilled label, no tree mutation in verify. Story-verify guard covers wrappers via env var, with a regression test. Bug status uses the fixed vocabulary. * docs(specs): persist e83 verify-work evidence Terminal verdict is a single Preflight gates run. * test(sync): guard against a doubled skill count in host manifests sync-post.sh built the .pi and gemini manifest descriptions from "${skill_count} skills — ${pkg_desc}", but package.json's description is already stamped with the count by stamp-skill-counts.sh, so a sync emitted "80 skills — 80 agent skills …". This test pins the invariant — the live count appears exactly once — and fails on the current tree. * fix(sync): stop stamping the skill count twice into host manifests stamp-skill-counts.sh writes the live count into package.json's description ("80 agent skills …"), and sync-post.sh then prefixed the count again for .pi/package.json and gemini-extension.json, producing "80 skills — 80 agent skills …". The committed artifacts predate the stamp, so sync-skills.sh could not reproduce what the branch commits and CI's `git diff --exit-code .pi .gemini/extensions/bigpowers` went red on every run. Strip the leading count before re-prefixing; sync is idempotent again and regenerates the committed text exactly. * docs(specs): refresh traceability matrix and codebase wiki for e83 Picks up e83s01-s05 as done plus the new test-manifest-skill-count-once.sh link. Generated content only; report timing churn was reverted rather than committed. * docs(specs): audit and security-review e83; log the fail-open release gate specs/AUDIT_LATEST.md and specs/security/REVIEW.md still described fix/guard-git-flag-normalize (PR #194, 2 commits) while this branch carries 15 commits, yet assert-epic-gate.sh release reported "audit-code verified". Replace both with reviews of the real diff and record the gate defect as BUG-2026-11-07-assert-epic-gate-fail-open. * docs(specs): regenerate traceability outputs for the new release-gate bug Generated by compliance/trace runs after BUG-2026-11-07-assert-epic-gate-fail-open was registered and the spec-version-gap bug bundle was first emitted. * docs(specs): correct the audited commit count to 18 * fix(okf): accept the mixed receipt source and require its breakdown e83s03 taught build-receipts.sh to label a blended reading "mixed" and verify-e83.sh asserts that label, but validate-okf-kinds.sh allowed only measured/estimated/backfilled/absent. CI's sync job therefore failed on the committed specs/receipts.json. Accept "mixed" and strengthen the validator while doing it: a mixed reading must carry value.source_breakdown, its keys must be known sources, and the parts must sum to value.story_count. A "mixed" label without evidence stays a failure. * test(gates): validate the OKF directories that CI validates The local gate set never ran validate-okf.sh over specs/, so compliance and run-verification-gates.sh both reported green while CI's sync job was red on e83s03. Add an okf-bundles gate covering the same six directories CI covers, so the two lists cannot drift apart silently. * docs(specs): record the OKF gate parity fix in the e83 audit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #184 (defect family 5 / e86 — application & script security).
guard-gitmatched literal substrings against the raw command. Reordering a flag, or putting a gitglobal option in front of the subcommand, walked straight through — and one sanctioned shape was
blocked by mistake. The guard now judges the parsed invocation.
scripts/lib/git-argv.py(quote-aware tokenizer → strip-C <path>,-c k=v,--no-pager,--git-dir=…→ decide on(subcommand, arguments)).extensions/omp-hooks.ts(tokenizeArgs/gitInvocations/classifyGitInvocation/dangerousGitCommand), which is what thetool_callhandler now calls,so the shell hooks and the extension cannot drift silently.
hooks/pre-tool-use.shandhooks/pre/bash.sh. If the helper is unreachable (hooksymlinked outside an installed package) the hooks keep the legacy literals rather than degrade to
allow-everything. Non-git commands skip the helper entirely (per-tool-call latency).
skills/guard-git/SKILL.mddocuments the argv rule and how to add one.Rules
reset+--hard·cleanwith any-f*/--force·branch -Dor--delete+ force ·checkoutwith-f/--forceor a.pathspec ·restorewith--worktreeor.·pushwith-f/--force/+refspecunless--force-with-lease.Evidence
Pre-fix, the same 29-row fixture table against the old hook: 20 correct, 8 bypassed, 1 false
positive.
Post-fix,
bash scripts/test-guard-git-normalize.sh:Mutation check (anti-vacuity): commenting out the classifier call in the hook fails 20 of 29 rows,
so the gate bites. Wired as
guard-git-normalizeinscripts/lib/golden-suite-gates.sh(7s).Two defects found while doing this (logged, one fixed here)
hooks/pre/bash.shhad a syntax error since feat(e82): upstream fork innovations — Jujutsu VCS, OMP plugin, community credit #118(
BUG-2026-11-03-pi-shell-hook-dead):[[ =~ …([^"]+)… ]]does not parse, so the pi/OMP shellfallback never executed a single check. Regex hoisted to a variable; section (d) now runs
bash -non it.-m(
BUG-2026-11-03-guard-attribution-second-m):git commit -m "fix(x): y" -m "Co-authored-by: bot"still passes, and the TS extension has no attribution check at all. That needs its own red/green
cycle in both implementations.
mainanywhere in thecommand (
BUG-2026-11-03-guard-push-target-matches-text): it blocked this very branch's pushbecause an
echo "=== commits ahead of main ==="sat in the same command line.Preflight
npm run compliance→ 0bash scripts/run-verification-gates.sh→ PASS (omp-extension0.8s,guard-git-normalize7s)bash scripts/sync-skills.sh→ 0, idempotent on re-run (generated.cursor/.gemini/.picopies of the skill doc committed with it)
bash scripts/trace-stories.sh --strict→ 0Test plan
bash scripts/test-guard-git-normalize.sh→ 4 passedgit -C /tmp reset -q --hardblocked,git push --force-with-lease origin feat/xallowedbash scripts/validate-omp-extension.sh→ passed