De-fork the hook: adopt cli-guard's shared engine #37

Merged
coilysiren merged 2 commits from chore/defork-cli-guard-hook into main 2026-06-03 22:24:56 +00:00
Owner

What

De-forks ward's hook off its private copy of the engine and onto cli-guard's shared hook package. Closes #36 and unblocks the protected-binary half of #4.

Commits

  • chore(deps): migrate cli-guard to the forgejo module path — drops the stale github.com/coilysiren/cli-guard pin for the canonical forgejo.coilysiren.me/coilyco-flight-deck/cli-guard@e102d72 (the merged protected-binary primitives, cli-guard #54/#55). Behavior-preserving.
  • refactor(hook): adopt cli-guard's shared hook engine — deletes ward's forked splitSegments/stripEnvPrefix/leadingToken/checkBinaryPath/routeHint/tableFor/prefix and delegates the Bash decision to hook.PreToolUse. ward's route tables pass as []hook.Route (gh-GraphQL suffix via Route.Extra), the guard-binary allow-list as []hook.IntegrityRule. ward keeps what the engine doesn't own: the file-write sidequest-registry check and coily-vs-ward guard selection.

Behavior

All existing hook tests pass unchanged. Adopting the engine gains the arbitrary-code-execution denies the fork lacked — interpreter (python3 -c ...), exfil (echo $VAR), scratch-exec (/tmp/payload.sh) — a deliberate security improvement (see #19), locked by two new ward-level tests.

Validation

go build ./..., go test ./..., go vet ./... green against the forgejo cli-guard module. No github.com/coilysiren/cli-guard references remain.

Next (not in this PR)

ward doctor security, the security:-config → hook.Protected wiring, and WARD_CONFIG/--config resolution land on top, under #4.

## What De-forks ward's hook off its private copy of the engine and onto cli-guard's shared `hook` package. Closes #36 and unblocks the protected-binary half of #4. ## Commits - **`chore(deps): migrate cli-guard to the forgejo module path`** — drops the stale `github.com/coilysiren/cli-guard` pin for the canonical `forgejo.coilysiren.me/coilyco-flight-deck/cli-guard@e102d72` (the merged protected-binary primitives, cli-guard #54/#55). Behavior-preserving. - **`refactor(hook): adopt cli-guard's shared hook engine`** — deletes ward's forked `splitSegments`/`stripEnvPrefix`/`leadingToken`/`checkBinaryPath`/`routeHint`/`tableFor`/`prefix` and delegates the Bash decision to `hook.PreToolUse`. ward's route tables pass as `[]hook.Route` (gh-GraphQL suffix via `Route.Extra`), the guard-binary allow-list as `[]hook.IntegrityRule`. ward keeps what the engine doesn't own: the file-write sidequest-registry check and coily-vs-ward guard selection. ## Behavior All existing hook tests pass unchanged. Adopting the engine **gains** the arbitrary-code-execution denies the fork lacked — interpreter (`python3 -c ...`), exfil (`echo $VAR`), scratch-exec (`/tmp/payload.sh`) — a deliberate security improvement (see #19), locked by two new ward-level tests. ## Validation `go build ./...`, `go test ./...`, `go vet ./...` green against the forgejo cli-guard module. No `github.com/coilysiren/cli-guard` references remain. ## Next (not in this PR) `ward doctor security`, the `security:`-config → `hook.Protected` wiring, and `WARD_CONFIG`/`--config` resolution land on top, under #4.
Drops the stale github.com/coilysiren/cli-guard pin and requires the canonical
forgejo.coilysiren.me/coilyco-flight-deck/cli-guard@e102d72 (the merged
protected-binary primitives, cli-guard#54/#55). Import paths swapped in exec,
repocfg, hook; go.mod tidied. Behavior-preserving; tests unchanged.

First step of the hook de-fork.
Refs #36

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
refactor(hook): adopt cli-guard's shared hook engine
Some checks failed
release / release (push) Has been cancelled
release / bump-formula (push) Has been cancelled
test / test (push) Has been cancelled
test / test (pull_request) Has been cancelled
e9282dc25d
Deletes ward's forked hook primitives (splitSegments, stripEnvPrefix,
leadingToken, checkBinaryPath, routeHint, tableFor, prefix) and delegates the
Bash decision to cli-guard hook.PreToolUse, passing ward's route tables as
[]hook.Route (gh-GraphQL suffix via Route.Extra) and the guard-binary
allow-list as []hook.IntegrityRule. ward keeps the orchestration the engine
does not own: the file-write sidequest-registry check and coily-vs-ward guard
selection.

Adopting the engine also gains the arbitrary-code-execution denies the fork
lacked (interpreter, exfil, scratch-exec), locked by two new ward-level tests.
All existing hook tests pass unchanged. See ward#19.

closes #36

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.