Documentation
¶
Overview ¶
Package guard reviews a workflow body for safety violations before publish. Rule-based pre-flight (cheap, deterministic) per §17 of the design doc; the AI ephemeral-reviewer hook is left for callers to plug in via a custom Rule that spawns an agent.
Index ¶
Constants ¶
const ( ModeOff = "off" ModeWarn = "warn" ModeBlock = "block" )
Mode controls how violations are surfaced.
const ( SevLow = "low" SevMedium = "medium" SevHigh = "high" SevCritical = "critical" )
Severity levels.
Variables ¶
This section is empty.
Functions ¶
func ContentHash ¶
ContentHash produces a deterministic hash of the workflow's governance-relevant payload (graph + triggers + env schema).
Types ¶
type Config ¶
type Config struct {
Mode string `wick:"mode,dropdown=off|warn|block,default=warn,desc=Guard verdict policy"`
NetworkAllowlist []string // host substrings; only checked when set
}
Config is the runtime knob.
type DestructiveShellRule ¶
type DestructiveShellRule struct{}
DestructiveShellRule flags rm -rf, dd, mkfs, etc.
func (*DestructiveShellRule) Check ¶
func (r *DestructiveShellRule) Check(w workflow.Workflow) []Violation
func (*DestructiveShellRule) Name ¶
func (r *DestructiveShellRule) Name() string
type Guard ¶
Guard wires a set of rules.
type NetworkAllowlistRule ¶
type NetworkAllowlistRule struct {
AllowedHosts []string
}
NetworkAllowlistRule flags HTTP nodes hitting non-allowlisted hosts.
func (*NetworkAllowlistRule) Check ¶
func (r *NetworkAllowlistRule) Check(w workflow.Workflow) []Violation
func (*NetworkAllowlistRule) Name ¶
func (r *NetworkAllowlistRule) Name() string
type PlaintextSecretRule ¶
type PlaintextSecretRule struct{}
PlaintextSecretRule flags `password:` / `token:` / `api_key:` strings in node bodies.
func (*PlaintextSecretRule) Check ¶
func (r *PlaintextSecretRule) Check(w workflow.Workflow) []Violation
func (*PlaintextSecretRule) Name ¶
func (r *PlaintextSecretRule) Name() string
type PromptInjectionRule ¶
type PromptInjectionRule struct{}
PromptInjectionRule flags raw `{{.Event.X}}` interpolation into shell command args without sanitization.
func (*PromptInjectionRule) Check ¶
func (r *PromptInjectionRule) Check(w workflow.Workflow) []Violation
func (*PromptInjectionRule) Name ¶
func (r *PromptInjectionRule) Name() string
type Report ¶
type Report struct {
OK bool `json:"ok"`
Violations []Violation `json:"violations,omitempty"`
ContentHash string `json:"content_hash"`
}
Report is the aggregate verdict.
type Rule ¶
Rule is one inspection function. Returning empty slice means "nothing to flag for this rule". Implementations should be cheap and pure — they receive a defensive copy of the workflow.
type UnparameterizedSQLRule ¶
type UnparameterizedSQLRule struct{}
UnparameterizedSQLRule flags db_query bodies that string-concatenate template refs into SQL.
func (*UnparameterizedSQLRule) Check ¶
func (r *UnparameterizedSQLRule) Check(w workflow.Workflow) []Violation
func (*UnparameterizedSQLRule) Name ¶
func (r *UnparameterizedSQLRule) Name() string