Goal
Persist the existing privacy-minimized PEP decision events as a tenant-scoped, append-only, hash-chained PostgreSQL journal, so current reads and typed proposals no longer rely only on process logs for audit durability.
Parent: #24 (E6 F6.1/F6.3 foundation)
Depends on: #230 / PR #231
Scope
- Add a versioned canonical audit-entry envelope for the current PEP decision event only.
- Store one strictly ordered sequence and SHA-256 chain per workspace.
- Serialize concurrent appends by locking a per-workspace chain head in the same transaction as entry insertion and head advancement.
- Enforce workspace RLS and transaction-local scope on entries and heads.
- Deny the application role UPDATE/DELETE privileges on immutable entries.
- Verify sequence continuity, previous hashes, canonical entry hashes, and retained-head agreement.
- Wire the durable sink into the hub PEP so append failure continues to fail closed before an operation runs.
- Preserve the existing secret-minimizing boundary: no credentials, tokens, raw arguments, selectors, targets, result data, database URLs, or binding digests in journal entries.
Acceptance criteria
Non-goals / honest claim boundary
This slice does not complete F6.1 or F6.3. It does not add action lifecycle phases, intent-id correlation, the Ardur decision ledger, query/export APIs, retention, WORM media, external timestamping, or externally signed checkpoints. A database owner could still replace the entire chain and head; externally anchored integrity is a later F6.3 slice.
It grants no write/action authority, credential access, network connector, shell, filesystem, dispatch, approval, or execution capability.
Security and reliability design
- OWASP recommends separate audit records, restrictive database command permissions, sensitive-data minimization, interaction identifiers, and tamper detection.
- PostgreSQL row locks serialize writers to the same head until transaction end; append and head advancement must be atomic.
- RLS is defense in depth, not a substitute for table privileges; immutable-entry UPDATE/DELETE must be revoked from the application role.
- The per-workspace head is mutable coordination state; the event history is immutable.
Cost / operability
Each policy decision adds one short database transaction and serializes within its workspace. This can become a hot-workspace bottleneck at high decision volume. Storage grows linearly; retention, archival, integrity-check metrics, and anchored checkpoints are deliberately deferred and must be designed before production-scale rollout.
Primary sources
Goal
Persist the existing privacy-minimized PEP decision events as a tenant-scoped, append-only, hash-chained PostgreSQL journal, so current reads and typed proposals no longer rely only on process logs for audit durability.
Parent: #24 (E6 F6.1/F6.3 foundation)
Depends on: #230 / PR #231
Scope
Acceptance criteria
Non-goals / honest claim boundary
This slice does not complete F6.1 or F6.3. It does not add action lifecycle phases, intent-id correlation, the Ardur decision ledger, query/export APIs, retention, WORM media, external timestamping, or externally signed checkpoints. A database owner could still replace the entire chain and head; externally anchored integrity is a later F6.3 slice.
It grants no write/action authority, credential access, network connector, shell, filesystem, dispatch, approval, or execution capability.
Security and reliability design
Cost / operability
Each policy decision adds one short database transaction and serializes within its workspace. This can become a hot-workspace bottleneck at high decision volume. Storage grows linearly; retention, archival, integrity-check metrics, and anchored checkpoints are deliberately deferred and must be designed before production-scale rollout.
Primary sources