Skip to main content
Every decision made through Attesta — whether auto-approved, manually approved, or denied — is recorded in a tamper-proof audit trail. The log uses a SHA-256 hash chain where each entry’s integrity depends on all previous entries, making it impossible to modify or delete records without detection.
Attesta supports pluggable audit backends. The default is a built-in SHA-256 hash-chained JSONL logger (described below). You can also use TrailProof as an alternative backend for enhanced features like HMAC signing and multi-tenancy. See the TrailProof Integration Guide for details.

Hash Chain Mechanism

Each audit entry contains a chain_hash computed from the previous entry’s hash and the current entry’s canonical JSON:
The first entry in the chain uses a genesis hash of "0" * 64 (64 zeros) as its previous_hash.
Canonical JSON means keys are sorted alphabetically, no extra whitespace, and consistent encoding. This ensures the same data always produces the same hash regardless of serialization order.

Storage Format

The audit trail is stored as JSONL (JSON Lines) — one JSON object per line, one line per entry. This format is:
  • Append-only — New entries are appended, never inserted
  • Streamable — Can be processed line-by-line without loading the entire file
  • Grep-friendly — Standard text tools work out of the box

AuditEntry Fields

Each entry in the audit trail contains these fields:

Usage


Chain Verification

The verify_chain() method walks the entire log from the genesis entry and recomputes every hash. If any entry has been modified, inserted, deleted, or reordered, the verification fails.

What Verification Catches

Chain verification is a forward-only operation — it can detect tampering but cannot recover the original data. For production use, consider replicating the audit log to an immutable store (S3 with Object Lock, append-only databases, etc.).

CLI Verification

The Attesta CLI provides a convenient command for chain verification:

Rubber-Stamp Detection

The find_rubber_stamps() method returns all entries where min_review_met is false — meaning the operator responded faster than the minimum review time for their challenge type.
Set up automated monitoring that runs find_rubber_stamps() on a schedule. A high rubber-stamp rate may indicate that operators are fatigued, that minimum review times are too aggressive, or that the risk scorer is generating too many false positives at higher risk levels.

Example Audit Entry

Challenge System

How challenges generate the audit data

CLI Audit Commands

Verify and query audit trails from the command line

TrailProof Integration

Switch to TrailProof for HMAC signing and multi-tenancy

Production Deployment

Best practices for audit logs in production