Documentation
¶
Overview ¶
Package tag holds the record of one drill run on one target, and the chain that links those records.
Index ¶
- Constants
- func EvidenceHash(e Evidence) (string, error)
- func HeaderHash(h Header) (string, error)
- func NextState(prev, verdict string, retired bool) string
- func Redact(t *Tag)
- func ScanSnapshot(s *graph.Snapshot, h graph.Hasher) int
- func ScanTag(t *Tag, h graph.Hasher)
- func ScanValue(v any, h graph.Hasher, where string, notes *[]string) any
- func Slug(s string) string
- type ChainStatus
- type Condition
- type Evidence
- type Header
- type Key
- type Store
- type Tag
Constants ¶
const ( Pass = "PASS" Fail = "FAIL" Warn = "WARN" NA = "N/A" Skip = "SKIP" Error = "ERROR" )
Verdicts for one run.
const ( Open = "OPEN" Closed = "CLOSED" Unknown = "UNKNOWN" Retired = "RETIRED" )
Safeguard states over time.
Variables ¶
This section is empty.
Functions ¶
func EvidenceHash ¶
EvidenceHash returns the SHA-256 of evidence.
func HeaderHash ¶
HeaderHash returns the SHA-256 of a header.
func NextState ¶
NextState applies the one rule: only FAIL opens a safeguard, and only PASS closes it. Every other verdict leaves the state where it was.
func Redact ¶
func Redact(t *Tag)
Redact replaces a tag's evidence with a redaction marker. The header, and so the chain, stays as it was.
func ScanSnapshot ¶
ScanSnapshot scans a snapshot's attributes before it is written, returning how many values it replaced.
Types ¶
type ChainStatus ¶
ChainStatus is the result of checking one history.
func VerifyChain ¶
func VerifyChain(history []*Tag) ChainStatus
VerifyChain checks that each header links to the previous one and that each evidence part matches its hash. Evidence replaced by a redaction marker is reported as redacted, never tampered.
type Condition ¶
type Condition struct {
Expr string `json:"expr"`
Result string `json:"result"` // true, false or an error message
}
Condition is the result of one condition.
type Evidence ¶
type Evidence struct {
Facts map[string]any `json:"facts,omitempty"`
Read []string `json:"read,omitempty"`
Redacted bool `json:"redacted,omitempty"`
}
Evidence is what the verdict was decided on.
type Header ¶
type Header struct {
DrillID string `json:"drill_id"`
DrillHash string `json:"drill_sha256"`
Version string `json:"firedrill_version"`
Target string `json:"target"`
Stream string `json:"stream"`
Verdict string `json:"verdict"`
Reason string `json:"reason,omitempty"`
State string `json:"state"`
Waived bool `json:"waived,omitempty"`
WaivedParts int `json:"waived_findings,omitempty"`
Severity string `json:"severity"`
Owner string `json:"owner,omitempty"`
Conditions []Condition `json:"conditions,omitempty"`
FactSources map[string]string `json:"fact_sources,omitempty"`
Time time.Time `json:"time"`
RanBy string `json:"ran_by"`
Attested bool `json:"attested"`
SaltPrint string `json:"salt_fingerprint,omitempty"`
EvidenceHash string `json:"evidence_sha256"`
Previous string `json:"previous_sha256,omitempty"`
ScannerNotes []string `json:"scanner_notes,omitempty"`
}
Header is the part of a tag the chain covers. It holds a hash of the evidence rather than the evidence, so evidence about a person can be redacted without breaking the chain.
type Store ¶
type Store struct{ Root string }
Store reads and writes tags under one directory.