Add hook.ForbiddenArgv: glob-pattern argv deny primitive (clean-room) #61
Labels
No labels
burndown-2026-06
sunday-sprint
coherence-core
consult
headless
interactive
P0
P1
P2
P3
P4
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
coilyco-flight-deck/cli-guard#61
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Scope
Add an argv-pattern deny primitive to the PreToolUse hook engine.
Today's
hook.Protectedis basename-aware only - it can refuseghentirely, but it cannot distinguish read verbs (gh pr view) from write verbs (gh pr create). It also cannot pattern-match on argv content (e.g. refuse any invocation that mentions a particular substring).Both gaps fit a single shell-glob match against the segment argv string. POSIX
fnmatchsemantics, not regex.Schema
Extends
repocfg.Security:Required:
description,matches_glob_any. Optional:hint(engine synthesizes "argv matched " deny if absent).Patterns are matched via
path/filepath.Matchagainst the post-StripEnvPrefixsegment soenv FOO=bar gh issue createclassifies the same as baregh issue create.Engine
hook.ForbiddenArgvtype matching the YAML shape (Description, MatchesGlobAny, Hint).forbidden ...ForbiddenArgvonPreToolUse(peer to the existingprotected ...Protected).evaluateSegmentruns the segment through everyForbiddenArgv.MatchesGlobAnybefore falling through to routes / integrity rules. First glob match wins; emitsDecision{Block: true, Message: <hint>}.description, emptymatches_glob_any, invalid glob syntax (anythingpath/filepath.MatchreturnsErrBadPatternfor).Acceptance
repocfg.Load; malformed entries return parse errors anchored to file:line.hook.PreToolUsedenies a segment matching any glob; passes through segments matching none.gh pr view,gh issue list,gh api repos/foo/bar,gh api graphql -f query=foo(no forbidden substring).gh issue create,gh pr create -t foo,gh repo delete,env GH_TOKEN=x gh release edit, plus the substring rule firing ongh api repos/<substring>/fooandforgejo issue create --repo <substring>/....Decision.Message, custom hint vs synthesized hint.protected ...Protectedbehavior unchanged. Consumers that pass only the existing variadics see identical output.hookcfg.ForbiddenFor(repocfg.Security)paralleling the existinghookcfg.ProtectedFor) maps the parsed schema into the engine type.docs/FEATURES.mdmentions the new type; godoc covers the new variadic and bridge function.Out of scope
forbidden_argvblocks in their own follow-ups.closes #N
🔒 Reserved by
ward agent claude— containerward-cli-guard-issue-61-claude-fe295423on hostkais-macbook-pro.localis carrying this issue (reserved 2026-06-18T07:29:45Z). Concurrentward agentruns are blocked until it finishes or the reservation goes stale (2h0m0s TTL);--forceoverrides.— Claude (she/her), via
ward agent