models

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package models defines the core data structures for agentcheck results.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding struct {
	Scanner     string   `json:"scanner"`
	Resource    string   `json:"resource"`
	Severity    Severity `json:"severity"`
	Description string   `json:"description"`
	Detail      string   `json:"detail,omitempty"`
}

Finding represents a single security concern detected during a scan. Resource must never contain actual secret values; key names and file paths only.

type RiskReport

type RiskReport struct {
	Summary     Summary      `json:"summary"`
	ScanResults []ScanResult `json:"scan_results"`
}

RiskReport is the top-level result of a full agentcheck scan. Summary is declared first to keep JSON key order: "summary" before "scan_results".

type ScanResult

type ScanResult struct {
	ScannerName string    `json:"scanner"`
	Findings    []Finding `json:"findings"`
	Skipped     bool      `json:"skipped"`
	SkipReason  *string   `json:"skip_reason"`
}

ScanResult holds the output of a single scanner's execution.

type Severity

type Severity string

Severity represents the risk level of a finding.

const (
	SeverityUncertain Severity = "UNCERTAIN" // check could not complete; unknown risk
	SeverityLow       Severity = "LOW"
	SeverityModerate  Severity = "MODERATE"
	SeverityHigh      Severity = "HIGH"
	SeverityCritical  Severity = "CRITICAL"
)

func ParseSeverity

func ParseSeverity(s string) (Severity, error)

ParseSeverity validates and converts a severity string to a Severity value. Input is case-insensitive. Returns an error for unrecognised values.

func ParseSeverityOrModerate

func ParseSeverityOrModerate(s string) Severity

ParseSeverityOrModerate converts a severity string to a Severity value. If the value is unrecognised or empty, it defaults to MODERATE. Use this for optional config fields where omission means "use the default".

func (Severity) Rank

func (s Severity) Rank() int

Rank returns the numeric rank of a severity (higher = more severe). UNCERTAIN is not rankable for CI purposes and returns -1.

type Summary

type Summary struct {
	Critical        int `json:"critical"`
	High            int `json:"high"`
	Moderate        int `json:"moderate"`
	Low             int `json:"low"`
	Uncertain       int `json:"uncertain"`
	ConfirmedTotal  int `json:"confirmed_total"`
	ScannersTotal   int `json:"scanners_total"`
	ScannersSkipped int `json:"scanners_skipped"`
}

Summary holds objective counts derived from all scan results. These are counts of actual findings, not computed scores. ConfirmedTotal is critical+high+moderate+low; UNCERTAIN findings are excluded because they represent incomplete checks rather than confirmed findings.

type UnknownSeverityError

type UnknownSeverityError struct {
	Value string
}

UnknownSeverityError is returned by ParseSeverity for unrecognised values.

func (*UnknownSeverityError) Error

func (e *UnknownSeverityError) Error() string

Jump to

Keyboard shortcuts

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