Documentation
¶
Overview ¶
Package rules provides a CEL-based rule engine for custom audit checks.
Rules are defined in YAML files and compiled once into efficient CEL programs. Each rule specifies a boolean condition that is evaluated against a crawled page; when the condition is true, the engine produces an model.Issue.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine holds pre-compiled CEL rules ready for evaluation.
func NewEngine ¶
NewEngine compiles the given rules into CEL programs and returns an Engine. An error is returned if any rule has an invalid CEL expression or glob pattern.
type Rule ¶
type Rule struct {
Name string `yaml:"name"`
Severity string `yaml:"severity"` // critical, warning, info
Match string `yaml:"match"` // URL glob pattern; empty or "*" matches everything
Condition string `yaml:"condition"` // CEL boolean expression
Message string `yaml:"message"` // human-readable issue message
}
Rule describes a single user-defined audit rule.
type RuleChecker ¶
type RuleChecker struct {
// contains filtered or unexported fields
}
RuleChecker adapts a rules Engine to the [audit.Checker] interface.
func NewRuleChecker ¶
func NewRuleChecker(engine *Engine) *RuleChecker
NewRuleChecker wraps an Engine as an audit.Checker.