radamsa

package
v1.105.4 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package radamsa parses radamsa's -M metadata log into structured records.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidReport = errors.New("invalid radamsa -M report")

ErrInvalidReport marks content that is not valid radamsa -M evidence: a malformed log, an archive entry that does not parse, a corrupt gzip stream, or a report that exceeds maxReportRecords. It is deliberately distinct from a file-access error so a caller can tell "bad evidence" (an invalid material) from "couldn't read the file" (a fixable I/O problem).

View Source
var ErrNoRecords = errors.New("no radamsa -M records found")

ErrNoRecords means a -M log held no parseable records (an empty or blank-only log). It is distinct from a malformed-line error so callers can tell a valid but empty report — zero fuzzing iterations — from content that is not a -M log at all.

Functions

func InspectReport added in v1.105.4

func InspectReport(path string) (int, error)

InspectReport validates a RADAMSA_REPORT material on disk — a single -M log, a plain-gzipped log, or an archive of logs — and returns the total number of parsed -M records. Archives are streamed rather than held in memory. It shares its content detection, per-entry parse, and record cap with ParseReportBytes (see that function) so the two cannot disagree about what a material contains.

Content problems are reported as ErrInvalidReport; file-access errors are surfaced as-is so callers can tell an invalid report from an unreadable file.

func Parse

func Parse(r io.Reader) ([]map[string]any, error)

Parse reads a radamsa -M metadata log and returns one record per non-blank line. Each record is a map of key -> value, where quoted values are unquoted strings, integer-looking bare values are int64, and other bare tokens are strings. It returns ErrNoRecords when no record is found and a distinct error when a line is malformed.

func ParseReportBytes added in v1.105.4

func ParseReportBytes(data []byte) ([]map[string]any, error)

ParseReportBytes parses radamsa -M metadata already held in memory — a single -M log, a plain-gzipped log, or an archive (zip/tar/tar.gz) of logs — and returns the records merged across every entry. Zero records is a valid, empty result (the gate then decides on zero iterations); malformed content is ErrInvalidReport and a malformed archive entry fails the whole material rather than being dropped.

This and InspectReport are the single shared definition of what a RADAMSA_REPORT material contains — same content detection, per-entry parse, and record cap — so the crafter's craft-time validation and the policy engine's eval-time projection cannot disagree. Were they to disagree, a material could be attested at craft time and then fail or silently skip policy evaluation, which on a compliance gate reads as a clean pass.

Types

This section is empty.

Jump to

Keyboard shortcuts

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