Documentation
¶
Overview ¶
Package audit writes a tamper-evident JSONL audit log. Every record embeds the SHA-256 of the previous record, forming a hash chain: editing or deleting any line breaks verification of every line after it.
Index ¶
Constants ¶
View Source
const ( // PhaseIntent is written before a mutating command runs, so an executed // action can never be missing from the log. PhaseIntent = "intent" // PhaseOutcome carries the result of the command. PhaseOutcome = "outcome" )
Phase distinguishes the two records a state-changing call produces.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger appends records to a JSONL file.
type Record ¶
type Record struct {
Seq int64 `json:"seq"`
Time time.Time `json:"time"`
Host string `json:"host"`
Tool string `json:"tool"`
// Phase is PhaseIntent or PhaseOutcome for mutating calls, empty for
// read-only calls and refusals, which produce a single record.
Phase string `json:"phase,omitempty"`
Args map[string]any `json:"args,omitempty"`
Decision string `json:"decision"`
Approved *bool `json:"approved,omitempty"`
ExitCode int `json:"exit_code"`
DurationMS int64 `json:"duration_ms"`
OutputSHA string `json:"output_sha256,omitempty"`
OutputLen int `json:"output_len"`
Err string `json:"error,omitempty"`
PrevHash string `json:"prev_hash"`
Hash string `json:"hash"`
}
Record is one audited tool call.
Click to show internal directories.
Click to hide internal directories.