Documentation
¶
Overview ¶
Package security provides a plugin-based security layer for evaluating events.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check interface {
// Name returns the unique identifier for this check.
Name() string
// Check evaluates the event and returns a result.
Check(ctx context.Context, event *events.Event) (*CheckResult, error)
// Enabled returns whether this check is currently active.
Enabled() bool
}
Check defines the interface for security checks.
type CheckResult ¶
type CheckResult struct {
// Decision is the outcome of this check.
Decision Decision
// Reason is required for Block decisions, explaining why the action was blocked.
Reason string
// Guidance is optional advisory text for the agent.
Guidance string
// CheckName identifies which check produced this result.
CheckName string
}
CheckResult represents the result of a single security check.
type Config ¶
type Config struct {
// FailOpen determines behavior when a check returns an error.
// If true, check errors don't block (fail open).
// If false, check errors cause blocking (fail closed).
FailOpen bool
}
Config holds configuration options for the security evaluator.
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator orchestrates security checks against events.
func (*Evaluator) Evaluate ¶
Evaluate runs all registered checks against the event and returns an aggregated result. Checks are evaluated in order, and evaluation stops immediately on a Block decision.
func (*Evaluator) RegisterCheck ¶
RegisterCheck adds a security check to the evaluator.
type Result ¶
type Result struct {
// FinalDecision is the overall decision after evaluating all checks.
FinalDecision Decision
// BlockReason is the reason if the action was blocked.
BlockReason string
// BlockedBy is the name of the check that blocked the action.
BlockedBy string
// Guidance contains aggregated guidance from all checks.
Guidance []string
// CheckResults contains the individual results from each check.
CheckResults []*CheckResult
// Error contains any error that occurred during evaluation.
Error error
}
Result aggregates results from all security checks.
func NewAllowResult ¶
func NewAllowResult() *Result
NewAllowResult creates a new Result with an Allow decision.
func (*Result) AggregatedGuidance ¶
AggregatedGuidance returns all guidance joined with newlines.
func (*Result) HasGuidance ¶
HasGuidance returns true if there is any guidance to provide.