Concepts

Audit chain

HMAC-SHA256 hash-chained, append-only, tamper-evident.

Schema#

Every decision appends a row to audit_logs with:

  • sequence_number: strictly monotonic per org, serialized via a PostgreSQL advisory lock
  • prev_entry_hash: the entry_hash of the previous row
  • entry_hash: HMAC-SHA256 of the canonical string, under Tracehold's audit signing key
  • hmac_schema_version: lets you rotate the canonical layout forward without invalidating old rows

The canonical string covers every field an attacker with UPDATE rights could plausibly want to rewrite: seq, org, actor, agent, task, action, user, event_type, summary, parameters_hash, decision, execution_status, nist_controls, owasp_tags, trace_id, risk_level, cloud_provider, created_at, and prev_hash.

Append-only at the database layer#

The audit_logs table has database triggers that raise on any UPDATE or DELETE, so no code path and no mistaken query can rewrite or remove a row. Rewriting history any other way breaks the hash chain, which verification and your connector's copy would show.

Verification#

GET /api/v1/audit/verify walks every row for your org, recomputes each canonical string under the stored schema version, and checks the HMAC + prev-hash pointer. Two error classes:

  • Chain break at seq=N: prev_hash mismatch: insertion or deletion detected
  • Tampered entry at seq=N: entry_hash mismatch: a field covered by the canonical string was modified

Your own copy#

Your connector can keep a copy of the whole chain in an S3 bucket in your account (TRACEHOLD_CONNECTOR_AUDIT_BUCKET): every entry with its sequence number and hashes, brought up to date every minute, plus one record per call naming its entry in the chain. Tracehold cannot change that copy, so if its chain were ever rewritten, your copy would no longer match. See the connector.

Key rotation#

Tracehold can rotate the signing key without breaking verification: entries written before the rotation still verify under the previous key.

Compliance bundle#

On Team and Enterprise, POST /api/v1/compliance/export/bundle (Audit → Evidence in the app) returns a zip of the period's evidence: the actions, the audit chain, the keys your connector used, control coverage and a proof of the chain's first and last entries, with MANIFEST.json (the SHA-256 of each file) and its SIGNATURE (every file).

Anyone can check the files against MANIFEST.json with sha256sum, and compare chain_proof.json with your connector's copy of the chain. SIGNATURE is an HMAC under Tracehold's secret signing key, which has no public half, so only Tracehold can check it.