Documentation
¶
Overview ¶
Package policy turns a scan result into a pass/fail decision and a process exit code. Keeping it separate from the scanner means CI behaviour can change without touching how findings are produced.
Index ¶
Constants ¶
const ( ExitOK = 0 // scan completed and policy passed ExitUsage = 1 // bad flags or configuration ExitPolicyFail = 2 // scan completed and policy failed ExitIncomplete = 3 // scan could not determine an answer ExitInternal = 4 // the scanner itself broke )
Exit codes. These are part of the CLI contract; existing values must not be reassigned.
const FailOnNone = "none"
FailOnNone is the spelling that turns the severity gate off. It is not a severity, so it never reaches ParseSeverity.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Policy ¶
type Policy struct {
// FailOn is the lowest severity that fails the build. Empty disables the
// severity gate.
FailOn model.Severity
// FailOnUnknown fails the build when the scan could not complete. This
// defaults to true, because an unknown result is not a pass.
FailOnUnknown bool
// Baseline holds finding IDs that are accepted for now. Baselined findings
// stay in the report, marked suppressed.
Baseline map[string]string // finding ID -> reason
}
Policy is the gate applied after a scan