Help us shape the future of Go! Take the 2026 Go Developer Survey

auditcli

package
v0.23.2 Latest Latest
Warning

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

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

Documentation

Overview

Package auditcli is the bide audit command: it produces and verifies audit ProofBundles from the command line, for the auditor/compliance persona who does not write Go. It is deliberately dependency-light: it imports only the core + audit packages (stdlib under the hood), no store backend, so it works against any store by operating on an exported journal (a JSON array of records) and a signed tree head. `verify` needs neither: just the bundle and a public key.

# Produce a proof that one tool call happened, against an anchored STH:
bide audit prove -journal run.json -sth sth.json -tool call_abc -out proof.json

# Verify it offline, trusting only an out-of-band public key:
bide audit verify -bundle proof.json -pubkey ed25519:1a2b...   # only exit 0 means verified

Exit status: 0 verified, 1 not verified, 2 usage error, 3 no verdict, 4 input unreadable or unusable (see exitFor). Only 0 means verified.

Export the journal with audit.ExportJournal(ctx, store, runID), marshaled to JSON.

Index

Constants

This section is empty.

Variables

View Source
var LoadLogSigner func(ref string) (audit.Signer, error)

LoadLogSigner loads the private key that signs a stop-trail head (-log-key). The full bide command sets it (a key file, the file form bide keygen writes); the audit-only build leaves it nil, so -sign-head is refused there and the verifier's import graph stays the standard library and the core module.

Functions

func Main

func Main(stamped string, args []string, stdout, stderr io.Writer) int

Main runs the command line args (without the program name) and returns the exit status. stamped is the release version the program was built with (set by the linker), or "" to read it from the build's module information.

func MainWith added in v0.21.0

func MainWith(stamped string, args []string, stdout, stderr io.Writer, opts Options) int

MainWith is Main with options: bide-hsm audit stops runs the stops verb alone, with the log key opened by reference.

Invocations are serialised: the verbs share a few settings (the input cap, the clock skew, the version) that their flags write, so two at once in one process would race. A command line runs one per process; the lock is for a test or a program that calls it from several goroutines.

func Verbs

func Verbs() []string

Verbs returns the name of every verb, sorted.

Types

type NotifyStores added in v0.17.0

type NotifyStores struct {
	Journal agent.Store      // the run journals, which must list their runs (agent.Lister)
	Events  audit.EventStore // the notification trails
	Close   func() error     // releases both
}

NotifyStores is a journal and an event store opened for bide audit notifications, read-only.

type Options added in v0.21.0

type Options struct {
	// Program is the command's name in its usage errors and its -json report (default "bide audit").
	Program string
	// OnlyVerb, when set, is the one verb the command runs; any other is a usage error that does not echo it.
	OnlyVerb string
	// UsageText replaces the usage text the command prints.
	UsageText string
	// LogKeyHelp replaces the description of what the stops verb's -log-key names (default: a key file).
	LogKeyHelp string
	// LogKeyFlags adds flags to the stops verb that say how the log key is opened.
	LogKeyFlags func(fs *flag.FlagSet)
	// LoadLogSigner replaces the package's LoadLogSigner for the stops verb's -sign-head.
	LoadLogSigner func(ref string) (audit.Signer, error)
	// Stores replaces the package's Stores for the stops verb's -db and -postgres-env.
	Stores *StoreOpeners
}

Options set how the command presents itself and which verb it runs. The zero value is bide audit. It is passed to MainWith and held by the invocation, so two commands in one process do not share it.

type StoreOpeners added in v0.17.0

type StoreOpeners struct {
	SQLite   func(path string) (NotifyStores, error)
	Postgres func(dsn string) (NotifyStores, error)
}

StoreOpeners open the databases `bide audit notifications -db` and `-postgres-env` read. The core module carries no store driver, so the full bide command sets them (cmd/bide); in an audit-only build they are nil and those flags are a usage error: the verb then reads exported files only.

var Stores *StoreOpeners

Stores is set by the program that links the store drivers; nil if there are none.

Directories

Path Synopsis
Command auditmain is the audit CLI as a program of its own, which the auditcli tests build to run a binary (exit statuses, the version stamp, files resolved from the working directory).
Command auditmain is the audit CLI as a program of its own, which the auditcli tests build to run a binary (exit statuses, the version stamp, files resolved from the working directory).

Jump to

Keyboard shortcuts

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