forensics

package
v0.7.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyBundleAttestation

func VerifyBundleAttestation(bundlePath, attestationPath string, pub ed25519.PublicKey) error

VerifyBundleAttestation re-reads the bundle and its DSSE attestation and confirms the signature covers the current bundle bytes. It returns an error if the attestation is missing, the signature is invalid for pub, or the bundle on disk no longer matches the signed digest (i.e. it was tampered after signing).

func VerifyBundleAttestationBytes added in v0.6.0

func VerifyBundleAttestationBytes(bundleRaw []byte, attestationPath string, pub ed25519.PublicKey) error

Types

type BatchBundle

type BatchBundle struct {
	SchemaVersion string               `json:"schema_version"`
	BundleID      string               `json:"bundle_id"`
	ExportedAt    string               `json:"exported_at"`
	Query         BatchExportOptions   `json:"query"`
	Summary       BatchSummary         `json:"summary"`
	RunBundles    []BundleInfo         `json:"run_bundles,omitempty"`
	EvalContexts  []signal.EvalContext `json:"eval_contexts,omitempty"`
	Commands      []BatchCommandRef    `json:"commands"`
	ResultSetID   string               `json:"result_set_id"`
	PageHash      string               `json:"page_hash"`
}

type BatchBundleInfo

type BatchBundleInfo struct {
	SchemaVersion string             `json:"schema_version"`
	ID            string             `json:"id"`
	BatchID       string             `json:"batch_id,omitempty"`
	Path          string             `json:"path"`
	SHA256        string             `json:"sha256"`
	SizeBytes     int64              `json:"size_bytes"`
	Status        string             `json:"status"`
	CreatedAt     string             `json:"created_at"`
	RunCount      int                `json:"run_count"`
	ItemCount     int                `json:"item_count"`
	ResultSetID   string             `json:"result_set_id"`
	PageHash      string             `json:"page_hash"`
	RunBundles    []BundleInfo       `json:"run_bundles,omitempty"`
	Query         BatchExportOptions `json:"query"`
}

type BatchCommandRef

type BatchCommandRef struct {
	RunID            string `json:"run_id"`
	EvidenceManifest string `json:"evidence_manifest"`
	EvalContext      string `json:"eval_context"`
	Explain          string `json:"explain"`
	ForensicsExport  string `json:"forensics_export"`
}

type BatchExportOptions

type BatchExportOptions struct {
	BatchID             string `json:"batch_id,omitempty"`
	RunID               string `json:"run_id,omitempty"`
	JobID               string `json:"job_id,omitempty"`
	ShardID             string `json:"shard_id,omitempty"`
	Latest              bool   `json:"latest,omitempty"`
	Limit               int    `json:"limit"`
	IncludeRunBundles   bool   `json:"include_run_bundles"`
	IncludeEvalContexts bool   `json:"include_eval_contexts,omitempty"`
}

type BatchHead

type BatchHead struct {
	BatchID     string         `json:"batch_id"`
	InputSHA256 string         `json:"input_sha256"`
	StartedAt   string         `json:"started_at"`
	EndedAt     string         `json:"ended_at"`
	JobCount    int            `json:"job_count"`
	Passed      int            `json:"passed"`
	Failed      int            `json:"failed"`
	Skipped     int            `json:"skipped"`
	Shards      map[string]int `json:"shards,omitempty"`
	ResultSetID string         `json:"result_set_id"`
	PageHash    string         `json:"page_hash"`
	CreatedAt   string         `json:"created_at"`
}

type BatchItem

type BatchItem struct {
	BatchID                 string   `json:"batch_id"`
	Index                   int      `json:"index"`
	JobID                   string   `json:"job_id,omitempty"`
	ShardID                 string   `json:"shard_id,omitempty"`
	RunID                   string   `json:"run_id,omitempty"`
	AttemptID               string   `json:"attempt_id,omitempty"`
	ToolCallID              string   `json:"tool_call_id,omitempty"`
	ProcessID               string   `json:"process_id,omitempty"`
	Workdir                 string   `json:"workdir,omitempty"`
	Command                 string   `json:"command,omitempty"`
	Status                  string   `json:"status"`
	ExitCode                int      `json:"exit_code"`
	WallMS                  int64    `json:"wall_ms"`
	ChangedFileCount        int      `json:"changed_file_count"`
	ChangedFiles            []string `json:"changed_files,omitempty"`
	Error                   string   `json:"error,omitempty"`
	EvidenceManifestCommand string   `json:"evidence_manifest_command,omitempty"`
	EvalContextCommand      string   `json:"eval_context_command,omitempty"`
	ExplainCommand          string   `json:"explain_command,omitempty"`
}

type BatchSummary

type BatchSummary struct {
	SchemaVersion string             `json:"schema_version"`
	Query         BatchExportOptions `json:"query"`
	BatchCount    int                `json:"batch_count"`
	ItemCount     int                `json:"item_count"`
	Passed        int                `json:"passed"`
	Failed        int                `json:"failed"`
	Skipped       int                `json:"skipped"`
	StatusCounts  map[string]int     `json:"status_counts"`
	Shards        map[string]int     `json:"shards,omitempty"`
	RunIDs        []string           `json:"run_ids"`
	Batches       []BatchHead        `json:"batches"`
	Items         []BatchItem        `json:"items"`
	ResultSetID   string             `json:"result_set_id"`
	PageHash      string             `json:"page_hash"`
}

func BuildBatchSummary

func BuildBatchSummary(db *sql.DB, opts BatchExportOptions) (BatchSummary, error)

type BundleInfo

type BundleInfo struct {
	SchemaVersion   string `json:"schema_version"`
	ID              string `json:"id"`
	RunID           string `json:"run_id"`
	Path            string `json:"path"`
	SHA256          string `json:"sha256"`
	SizeBytes       int64  `json:"size_bytes"`
	Status          string `json:"status"`
	CreatedAt       string `json:"created_at"`
	Signed          bool   `json:"signed"`
	AttestationPath string `json:"attestation_path,omitempty"`
}

type ImportInfo added in v0.4.0

type ImportInfo struct {
	SchemaVersion string         `json:"schema_version"`
	RunID         string         `json:"run_id"`
	BundlePath    string         `json:"bundle_path"`
	BundleSchema  string         `json:"bundle_schema"`
	Tables        map[string]int `json:"tables"`
	TotalRows     int            `json:"total_rows"`
	ObjectBlobs   int            `json:"object_blobs"`
	SnapshotFiles int            `json:"snapshot_files"`
	Omitted       int            `json:"omitted_content"`
}

ImportInfo summarizes a bundle import: which run was loaded and how many rows landed in each table.

type Service

type Service struct {
	DB    *sql.DB
	Paths store.Paths
	// SignKey, when set, makes ExportBundle emit a capture-time DSSE/in-toto
	// attestation over the bundle's sha256 for tamper-evidence.
	// When nil, bundles are produced unsigned and behavior is unchanged.
	SignKey   ed25519.PrivateKey
	SignKeyID string
}

func (Service) Export

func (s Service) Export(runID string) (string, error)

func (Service) ExportBatch

func (s Service) ExportBatch(opts BatchExportOptions) (BatchBundleInfo, error)

func (Service) ExportBundle

func (s Service) ExportBundle(runID string) (BundleInfo, error)

func (Service) ImportBundle added in v0.4.0

func (s Service) ImportBundle(path string) (ImportInfo, error)

ImportBundle re-hydrates a forensics bundle into the local store so the run can be browsed and replayed exactly as captured. It is the playback half of "capture once, replay anywhere": export (optionally signed) on the sandbox/VM, import into a fresh `init`'d store on any machine. Rows are inserted verbatim with INSERT OR REPLACE inside a single transaction.

Jump to

Keyboard shortcuts

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