Inside the Tamper-Evident Decision Evidence Vault: PostgreSQL RLS, Hash Chains & Offline Verification
How we combine PostgreSQL 18 row-level security, SHA-256 receipt chaining, ECDSA P-256 checkpoints, and an offline verifier CLI so audits do not require trusting the runtime database.
Key Takeaways
- The runtime PostgreSQL role (aa_app) has no BYPASSRLS privilege and is denied UPDATE/DELETE on evidence, approval, and revocation tables.
- Every receipt links to its predecessor via SHA-256 chain hashing and periodically anchors into signed ECDSA P-256 checkpoints.
- Auditors can verify exported JSON evidence bundles completely offline using the aa-verify CLI and retired-key trust history.
Defense in depth inside PostgreSQL 18
Audit logs stored in mutable application tables fail under scrutiny: a compromised application credential can rewrite history. In ActEscrow, the runtime application connects as aa_app with strict tenant-scoped Row-Level Security and database triggers/permissions that prohibit updates or deletes on the evidence ledger.
Even if a bug attempts to mutate a past decision receipt, the database rejects the statement before it touches disk.
ECDSA P-256 checkpoints and retired-key continuity
Hash chains detect tampering between neighboring rows, while periodic checkpoints signed with an asymmetric ECDSA P-256 key bind the chain head to an external verifier key.
When an organization rotates its anchoring key, retired public keys remain verifiable in the trust manifest so historical receipts from previous quarters still validate cleanly without re-signing old records.
dotnet run --project tools/AgentAssurance.Verifier -- \
--tenant acme --export ./export-pages \
--checkpoints ./checkpoints --public-key ./trusted-anchor.pem \
--expected-head-hash "$INDEPENDENT_HEAD_HASH" --jsonMinimal-PII payloads, GDPR redaction, and dual-admin legal holds
Evidence vaults must balance auditability with data minimization. Receipts store canonical digests, policy versions, principal IDs, and outcome metadata while avoiding unnecessary raw PII.
When retention windows expire, scheduled redaction scrubs sensitive fields unless an active legal hold—requiring dual-admin authorization—locks the record for investigation.
Honest cryptographic scope
Hash chains and ECDSA signatures prove recorded bytes were not altered after signing; downstream ERP read-back confirms target state at execution time, not upstream LLM reasoning quality.
What an auditor actually checks, step by step
The vault is only useful if someone outside the runtime can test it. A typical review starts with a paged export of one tenant's events for a period, plus the anchoring key manifest. The auditor runs aa-verify on their own machine. It recomputes each event hash from the canonical fields, confirms each event points at its predecessor, checks that sequence numbers have no gaps, and validates each signed checkpoint against the key named in it, including retired keys.
Where external anchors are enabled, the auditor can compare checkpoint heads in the export with the copies held in WORM storage such as S3 Object Lock. A match shows that the chain head existed at anchoring time and was not rebuilt later. Hourly scheduled verification inside the platform gives operators earlier warning, but the offline run is what removes the need to trust the server.
Which failures the vault detects, and which it does not
It helps to be precise about what each layer catches, so nobody over-reads a green verification result.
- Edited row: detected, because the recomputed hash no longer matches and every later link breaks.
- Deleted row in the middle: detected through the sequence gap and the broken predecessor link.
- Chain rewritten from an old point: detected when signed checkpoints or external anchors disagree with the new head.
- Truncated tail after the last checkpoint: only detected once the next checkpoint or anchor exists, so anchor frequency matters.
- A wrong decision recorded faithfully: not detected; the vault proves what was recorded, not that the policy was wise.
Payloads stay minimal
Evidence holds ids, digests and states. Bank details and other personal data stay in the ERP, which keeps exports safe to hand to an auditor.
Security scope and deployment prerequisites
This is a pilot implementation, not a zero-risk guarantee or compliance certification. Examples describe repository capabilities or deployment recommendations, not proof that a live installation has enabled them.
Every enrolled write fails closed during control-plane outages. Privileged control-plane MFA is mandatory outside Development, but accepted MFA claims do not prove recent authentication or hardware-backed WebAuthn unless the identity provider enforces those properties.
Per-agent deactivation blocks new evaluations and redeems and cancels Pending/Approved actions; it cannot recall an already executing ERP write. Evidence verifies recorded events, not unrecorded ERP activity; independently retained heads and trusted keys are needed to detect truncation or replacement.
Production blockers remain
The static portal still uses sessionStorage tokens (BFF not implemented). Off-host backup signing, immutable backup storage, live IdP MFA/logout testing, restore drills, adapter validation, monitoring, and legal review require deployment-specific work. Anchoring and SIEM forwarding are optional and must be configured and tested. See the repository deployment guide and runbook gap register before using real customer data.
Related deep dives
Defending Against AI-Assisted Invoice Redirection Fraud: Two-Person IBAN & BIC Verification
Nov 21, 2026 · 3 min readSecurity & AuditGRC Automation (Vanta, Drata) vs. Cryptographic Decision Evidence Vaults
Nov 20, 2026 · 3 min readSecurity & AuditPrompt Guardrails (Lakera, NeMo, Llama Guard) vs. Cryptographic Intent Enforcement
Nov 16, 2026 · 3 min read