GebSecure Docs v0.1.0

Architecture · All ADRs

ADR 0005 — Append-only audit via ingest table and per-org hash chain

Architecture decision record — status: Accepted.

Status: Accepted

Decision#

Request paths insert audit records into audit_ingest inside the same transaction as the change (atomic, lock-free). The worker chains them into audit_events in order per organization:

hash_n = sha256(prev_hash ‖ canonical(record_n))

audit_events rejects UPDATE/DELETE/TRUNCATE via trigger and privileges. Retention may delete only the head of a chain and records a checkpoint, so the remainder stays verifiable. POST /v1/audit/verify recomputes every hash.

Consequences#

  • (+) Tampering — even by a database superuser who disables triggers — is detected (tested).
  • (+) No per-org lock on hot paths.
  • (−) Audit visibility lags the change by the chaining interval (~200 ms).