Audit retention and verification

Retention must support reconstruction: what was declared, what was observed, which trust checks ran, what decision was returned and whether the retained record was altered.

Two bounded primitives

PrimitivePurposeBoundary
EvidenceLedgerIn-memory append-only sequence with duplicate-id rejection and JSONL export.Useful for controlled replay; it is not durable enterprise storage.
AuditChainFile-backed hash-linked event records with schema and sequence verification.Detects alteration; availability, backup and access control remain external.

Evidence ledger

Each entry records a monotonic sequence, evidence identity, append time and immutable evidence object. Duplicate ids and missing integrity hashes are rejected.

ledger = EvidenceLedger()
ledger.append(evidence, appended_at=now)
ledger.export_jsonl("evidence.jsonl")

Hash-linked audit chain

Each event record contains sequence, previous hash, event and record hash. Verification recomputes the chain from the genesis hash and checks schema, sequence, previous link and record digest.

chain = AuditChain("audit/events.jsonl")
chain.append({
    "event": "assurance_decision",
    "service_id": decision.service_id,
    "state": decision.state.value,
    "evidence_ids": decision.evidence_ids,
})
verification = chain.verify()

Signed checkpoints

A checkpoint binds genesis hash, current head hash and record count to a signer. Verification first checks the live chain against the checkpoint head and count, then verifies the checkpoint signature.

checkpoint = chain.create_checkpoint(signer, "audit-key")
result = chain.verify_checkpoint(checkpoint, verifier)
Do not confuse tamper evidence with immutability. A local attacker may delete the entire file, replace both chain and checkpoint, or deny access unless independent custody, backups and access controls exist.

Minimum retained decision record

Operational controls

ControlWhy
Separate write and review rolesReduce unilateral alteration risk.
Independent checkpoint custodyMake whole-chain replacement detectable.
Retention and deletion policyMeet legal, privacy and evidence needs.
Backup and recovery testEnsure audit evidence remains available.
Periodic verificationDetect damage before the record is needed.

Operational basis

NIST SP 800-92 provides foundational guidance on log-source configuration, storage, protection, analysis, response and long-term management. The library primitives address only a small technical subset of that operational program.