Documentation
¶
Overview ¶
Package verify evaluates lightweight post-step / post-run assertions (exit code, stdout substring, file presence) used by Missions and MCP.
Index ¶
- Constants
- Variables
- func ComputeContentDigest(rec *EvidenceRecord) (string, error)
- func SignEvidence(contentDigest string, key []byte) string
- func SuiteFingerprint() string
- func VerifyEvidenceIntegrity(rec *EvidenceRecord, hmacKey []byte) error
- type Check
- type ControlCase
- type ControlKind
- type ControlOutcome
- type ControlReport
- type EvidenceCheckpoint
- type EvidenceInput
- type EvidenceKind
- type EvidenceRecord
- type EvidenceSubject
- type FileProbe
- type Observation
- type Record
- type Result
- type Spec
- type Store
Constants ¶
const EvidenceSchema = "vaultrun.verify.evidence.v1"
EvidenceSchema identifies the sealed verification export format.
const MaxEvidenceStdoutBytes = 64 << 10
MaxEvidenceStdoutBytes caps observation text embedded in evidence exports.
const SuiteID = "vaultrun-verify-controls-v2"
SuiteID is the frozen identity of the built-in verify control suite. Bump when control cases change (also update pinned fingerprint in tests).
Variables ¶
var ErrNotFound = errors.New("verification not found")
ErrNotFound is returned when a verification id does not exist.
Functions ¶
func ComputeContentDigest ¶ added in v0.3.4
func ComputeContentDigest(rec *EvidenceRecord) (string, error)
ComputeContentDigest returns SHA-256 hex of the canonical JSON payload with content_digest and sig cleared.
func SignEvidence ¶ added in v0.3.4
SignEvidence HMAC-SHA256s the content digest hex string.
func SuiteFingerprint ¶
func SuiteFingerprint() string
SuiteFingerprint returns a stable digest of the frozen control definitions.
func VerifyEvidenceIntegrity ¶ added in v0.3.4
func VerifyEvidenceIntegrity(rec *EvidenceRecord, hmacKey []byte) error
VerifyEvidenceIntegrity checks content_digest (and sig when key provided).
Types ¶
type Check ¶
type Check struct {
Name string `json:"name"`
Passed bool `json:"passed"`
Detail string `json:"detail,omitempty"`
}
Check is one assertion outcome.
type ControlCase ¶
type ControlCase struct {
ID string `json:"id"`
Kind ControlKind `json:"kind"`
Name string `json:"name"`
Description string `json:"description"`
Spec Spec `json:"spec"`
Observation Observation `json:"observation"`
FileExistsMap map[string]bool `json:"-"` // probe fixture; not part of public digest payload separately
ExpectedPassed bool `json:"expected_passed"`
}
ControlCase is one frozen evaluator control (FaultWright-style).
func ControlCasesPublic ¶
func ControlCasesPublic() []ControlCase
ControlCasesPublic returns the frozen cases without running them (for docs/debug).
type ControlKind ¶
type ControlKind string
ControlKind is positive (must pass) or negative (must fail).
const ( ControlPositive ControlKind = "positive" ControlNegative ControlKind = "negative" )
type ControlOutcome ¶
type ControlOutcome struct {
ID string `json:"id"`
Kind ControlKind `json:"kind"`
Name string `json:"name"`
Description string `json:"description"`
ExpectedPassed bool `json:"expected_passed"`
ObservedPassed bool `json:"observed_passed"`
Consistent bool `json:"consistent"`
Result Result `json:"result"`
}
ControlOutcome is the evaluation of one control against the live evaluator.
type ControlReport ¶
type ControlReport struct {
SuiteID string `json:"suite_id"`
Fingerprint string `json:"fingerprint"`
CreatedAt time.Time `json:"created_at"`
Passed bool `json:"passed"`
PipelineDiscriminates bool `json:"pipeline_discriminates"`
Controls []ControlOutcome `json:"controls"`
Summary string `json:"summary"`
}
ControlReport is the auditable record for a control-suite run.
func RunControls ¶
func RunControls() ControlReport
RunControls evaluates the frozen positive/negative suite against Evaluate. PipelineDiscriminates is true only when every control is consistent with expectation and the suite contains at least one passing positive and one failing negative observation.
type EvidenceCheckpoint ¶ added in v0.3.4
type EvidenceCheckpoint struct {
Spec Spec `json:"spec"`
Observation Observation `json:"observation"`
Checks []Check `json:"checks"`
Passed bool `json:"passed"`
}
EvidenceCheckpoint is one evaluated verify checkpoint inside an export.
type EvidenceInput ¶ added in v0.3.4
type EvidenceInput struct {
Actor string
SessionID *uuid.UUID
RunID *uuid.UUID
VerificationID *uuid.UUID
StepName string
Spec Spec
Observation Observation
Result Result
IncludeControls bool
HasCheckpoint bool
HMACKey []byte
}
EvidenceInput configures BuildEvidence.
type EvidenceKind ¶ added in v0.3.4
type EvidenceKind string
EvidenceKind classifies what the record contains.
const ( EvidenceKindCheckpoint EvidenceKind = "checkpoint" EvidenceKindControls EvidenceKind = "controls" EvidenceKindCombined EvidenceKind = "combined" )
type EvidenceRecord ¶ added in v0.3.4
type EvidenceRecord struct {
Schema string `json:"schema"`
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
Kind EvidenceKind `json:"kind"`
Passed bool `json:"passed"`
Subject EvidenceSubject `json:"subject"`
Checkpoint *EvidenceCheckpoint `json:"checkpoint,omitempty"`
Controls *ControlReport `json:"controls,omitempty"`
ContentDigest string `json:"content_digest"`
Sig string `json:"sig,omitempty"`
}
EvidenceRecord is a digests-and-optional-HMAC sealed verification export (FaultWright-style evidence packaging for VaultRun verify).
func BuildEvidence ¶ added in v0.3.4
func BuildEvidence(in EvidenceInput) (*EvidenceRecord, error)
BuildEvidence seals a verification export with content digest and optional HMAC.
type EvidenceSubject ¶ added in v0.3.4
type EvidenceSubject struct {
SessionID string `json:"session_id,omitempty"`
RunID string `json:"run_id,omitempty"`
VerificationID string `json:"verification_id,omitempty"`
StepName string `json:"step_name,omitempty"`
Actor string `json:"actor,omitempty"`
}
EvidenceSubject binds the record to optional VaultRun entities.
type FileProbe ¶
FileProbe reports whether a workspace-relative path exists. May be nil when Spec.FileExists is empty.
type Observation ¶
type Observation struct {
ExitCode *int `json:"exit_code,omitempty"`
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
}
Observation is the measured outcome to check against Spec.
type Record ¶
type Record struct {
ID uuid.UUID `db:"id" json:"id"`
SessionID *uuid.UUID `db:"session_id" json:"session_id,omitempty"`
RunID *uuid.UUID `db:"run_id" json:"run_id,omitempty"`
MissionRunID *uuid.UUID `db:"mission_run_id" json:"mission_run_id,omitempty"`
StepName string `db:"step_name" json:"step_name,omitempty"`
Spec json.RawMessage `db:"spec" json:"spec"`
Observation json.RawMessage `db:"observation" json:"observation"`
Passed bool `db:"passed" json:"passed"`
Checks json.RawMessage `db:"checks" json:"checks"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
}
Record is a persisted verification outcome.
type Spec ¶
type Spec struct {
ExitCodeZero *bool `json:"exit_code_zero,omitempty"`
StdoutContains string `json:"stdout_contains,omitempty"`
FileExists string `json:"file_exists,omitempty"`
}
Spec is a set of optional assertions. Empty fields are skipped.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists verification results.