
Verify Cryptographic Integrity and Zero-PII Invariants of an Audit Log
Source:R/audit.R
audit_log_verify.RdRecomputes the SHA-256 hash chain from GENESIS through the final entry in
a JSONL audit log, verifying sequence continuity (1..n), prev_hash links,
exact entry_hash digests, and absence of forbidden raw-text keys. Detects
field edits, deletions, insertions, line reordering, and truncation.
Value
An S3 object of class "airgap_audit_verification" with elements
valid, n_entries, first_invalid_seq, chain_head_hash, issues,
and verified_at.
Examples
tmp_log <- tempfile(fileext = ".jsonl")
pf <- preflight_isolation_check(endpoint = "http://127.0.0.1:11434")
audit_log_append(tmp_log, pf)
#> <airgap_audit_entry> #1 [preflight_check]
#> Run ID: preflight_20261128T203807Z_1648478b
#> Timestamp: 2026-11-28T20:38:07Z
#> Isolation: PASS
#> PII policy: NA
#> Prev hash: GENESIS
#> Entry hash: sha256:4e93582dfb3996c7ea2be0ff53ddc38e22e7c9d95cc565a26860a19ba9c1a55b
audit_log_verify(tmp_log)
#> <airgap_audit_verification> [VALID]
#> Entries verified: 1
#> Chain head hash: sha256:4e93582dfb3996c7ea2be0ff53ddc38e22e7c9d95cc565a26860a19ba9c1a55b
unlink(tmp_log)