Documentation
¶
Overview ¶
Package policy implements the PolicyGate port (ADR-0007). Local mode uses allow/ask/deny rules; server mode verifies an ES256 claim from a control plane. Rules support glob matching on tool name and path argument, with last-match-wins ordering. Ask decisions are resolved by an injected Prompter (with the caller's context deadline acting as the forced-ask timeout); when no Prompter is wired, Ask safely degrades to Deny.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowAll ¶
type AllowAll struct{}
AllowAll is a scaffold gate that permits everything. Equivalent to --dangerously-skip-permissions with no rules layered on top — use only in tests and local scaffolding, never as a shipped default.
type Decision ¶
type Decision int
func ParseDecision ¶
ParseDecision parses an allow/ask/deny string (case-insensitive).
type DenyList ¶
DenyList denies any tool call whose name is in Denied, allows everything else. A minimal, illustrative precursor to the full rule engine.
type Prompter ¶
Prompter asks an operator to approve an Ask decision. The context carries the forced-ask timeout (deadline). Implementations are UI seams (T-031 TUI).
type Prompting ¶
Prompting wraps a Rules engine with a Prompter, resolving Ask decisions interactively. It implements Gate. When Prompter is nil, Ask safely degrades to Deny (never silently allow).
type Rule ¶
type Rule struct {
ToolGlob string // glob against the tool name; "" matches any
PathGlob string // glob against a path argument; "" matches any/no path
Decision Decision
}
Rule is one permission rule. A call matches if the tool name matches ToolGlob (empty = any tool) AND a path argument, if the rule specifies one, matches PathGlob (empty = any/no path). Rules are evaluated in list order; the last matching rule wins.
type Rules ¶
Rules is the rule engine. It implements Gate.
type Skip ¶
type Skip struct {
Rules *Rules
}
Skip implements --dangerously-skip-permissions (T-024): an allow-all base where explicit rules still win, and prompts are skipped (Ask becomes Allow). It wraps a Rules engine whose Default is forced to Allow. Explicit Deny rules still deny; explicit Ask rules do not block. Use only for local/trusted runs.