norn

package
v0.35.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package norn evaluates scan results against policy to produce a verdict (pass/fail) per control and overall. It begins with declarative severity thresholds; a richer policy language (e.g. OPA/Rego) can follow.

The Norns decide fate — here, the fate of a release.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlOutcome

type ControlOutcome struct {
	Control         string
	Verdict         Verdict
	Highest         sarif.Level
	HighestPriority string
	Counts          sarif.Counts
	Threshold       sarif.Level
}

ControlOutcome is the verdict for a single control.

type Policy

type Policy struct {
	FailOn         sarif.Level
	PerControl     map[string]sarif.Level
	FailOnPriority string
}

Policy decides verdicts from findings. A control fails when its most severe finding is at least as severe as the applicable threshold. FailOn is the default threshold; PerControl overrides it for named controls. The zero value fails on error.

FailOnPriority adds component-aware gating: when set (e.g. "P1"), a control also fails if any of its findings has a priority band at least that urgent. Because a finding's priority already combines its severity with its component's exposure and criticality, this gates per component without a separate per-component threshold.

func (Policy) Evaluate

func (p Policy) Evaluate(reports map[string]sarif.Report) Result

Evaluate judges each control's report against the policy and combines them. The overall verdict is Fail if any control fails. Controls are reported in the given order (sort upstream for determinism if needed).

type Result

type Result struct {
	Verdict  Verdict
	Controls []ControlOutcome
}

Result is the overall evaluation across all controls.

type Verdict

type Verdict string

Verdict is the outcome of a policy evaluation.

const (
	Pass Verdict = "pass"
	Fail Verdict = "fail"
)

The possible verdicts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL