Documentation
¶
Overview ¶
Package policy implements the rules engine: YAML-defined conditions evaluated against the graph, with embedded default rules (PRD section 45).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Rule ¶
type Rule struct {
ID string `yaml:"id" json:"id"`
Name string `yaml:"name" json:"name"`
Severity string `yaml:"severity" json:"severity"`
// When selects source agents: a node-type filter plus optional
// provider and metadata match.
When RuleWhen `yaml:"when" json:"when"`
// DenyReach forbids the selected agents from reaching nodes matching
// the target selector.
DenyReach *Selector `yaml:"deny_reach" json:"deny_reach,omitempty"`
}
Rule is a policy definition.
type RuleWhen ¶
type RuleWhen struct {
NodeType string `yaml:"node_type" json:"node_type"`
Provider string `yaml:"provider,omitempty" json:"provider,omitempty"`
HasMetadata map[string]string `yaml:"has_metadata,omitempty" json:"has_metadata,omitempty"`
}
RuleWhen selects the agents a rule applies to.
type Selector ¶
type Selector struct {
NodeType string `yaml:"node_type" json:"node_type"`
Provider string `yaml:"provider,omitempty" json:"provider,omitempty"`
HasMetadata map[string]string `yaml:"has_metadata,omitempty" json:"has_metadata,omitempty"`
HasAnyTag []string `yaml:"has_any_tag,omitempty" json:"has_any_tag,omitempty"`
Environment string `yaml:"environment,omitempty" json:"environment,omitempty"`
Privilege string `yaml:"privilege,omitempty" json:"privilege,omitempty"`
CrownJewel *bool `yaml:"crown_jewel,omitempty" json:"crown_jewel,omitempty"`
}
Selector matches target nodes.
type Violation ¶
type Violation struct {
RuleID string `json:"rule_id"`
RuleName string `json:"rule_name"`
Severity string `json:"severity"`
Agent string `json:"agent"`
Target string `json:"target"`
TargetType string `json:"target_type"`
Path []string `json:"path"`
PathEdgeTypes []string `json:"path_edge_types"`
}
Violation is one rule breach.