Audit Chain

Every proxy action is logged to an append-only, tamper-evident audit chain.

Format

JSONL (JSON Lines). One entry per line.

{"seq":1,"ts":"2024-01-15T10:30:00Z","cap":"openai-chat","action":"request","outcome":"allowed","hash":"abc...","prev":"000...","sig":"def..."}
{"seq":2,"ts":"2024-01-15T10:30:01Z","cap":"openai-chat","action":"response","outcome":"success","hash":"ghi...","prev":"abc...","sig":"jkl..."}

Entry Fields

FieldDescription
seqSequence number, monotonically increasing
tsISO 8601 timestamp
capCapability name
actionrequest, response, blocked, error
outcomeResult: allowed, denied, rate_limited, taint_blocked, etc.
hashSHA-256 hash of this entry (excluding hash and sig)
prevHash of previous entry (chain link)
sigEd25519 signature of hash

Integrity Properties

Hash Chain

Each entry's prev field contains the previous entry's hash. Tampering with any entry breaks the chain.

Entry 1          Entry 2          Entry 3
┌──────┐        ┌──────┐        ┌──────┐
│hash_1│◄───────│prev  │◄───────│prev  │
└──────┘        │hash_2│        │hash_3│
                └──────┘        └──────┘

Signatures

Each entry is signed with an Ed25519 private key. The corresponding public key can be used to verify authenticity.

Verification

To verify an audit log:

  1. Check each entry's hash matches SHA-256 of entry content
  2. Check each entry's prev matches previous entry's hash
  3. Verify Ed25519 sig against hash using public key
  4. Check seq is monotonically increasing
  5. Check ts is monotonically increasing (within tolerance)

Storage

Default path: /var/log/hull0/audit.jsonl

Configurable via manifest settings.audit_path.

Compliance

The audit chain provides:

  • Non-repudiation (signatures)
  • Tamper evidence (hash chain)
  • Completeness (sequence numbers)
  • Temporal ordering (timestamps)

Suitable for SOX, HIPAA, GDPR audit requirements.