Audit log is append-only (tamper-resistant)
Why it matters
GDPR Article 5(2) accountability requires that compliance records be trustworthy — a mutable audit log provides no assurance because any entry could have been silently modified after the fact. CWE-472 (External Control of Assumed-Immutable Web Parameter) and CWE-778 (Insufficient Logging) both apply when audit records can be retroactively altered. NIST AU-9 explicitly requires protection of audit information from unauthorized modification and deletion. An audit log that a rogue service account or a poorly-reviewed migration can UPDATE or DELETE is worthless as legal evidence — it cannot prove what actually happened, only what the log currently says.
Severity rationale
High because a mutable audit log cannot be used as evidence in a regulatory investigation and provides no detection of tampering, invalidating GDPR Art. 5(2) accountability and ISO 27001:2022 A.8.15 compliance claims.
Remediation
Enforce immutability at the database level — application-layer checks alone are insufficient because any service with write access can bypass them:
-- Option 1: PostgreSQL RULE (blocks UPDATE and DELETE at the SQL parser level)
CREATE RULE audit_log_no_update AS ON UPDATE TO audit_log DO INSTEAD NOTHING;
CREATE RULE audit_log_no_delete AS ON DELETE TO audit_log DO INSTEAD NOTHING;
-- Option 2: Row Level Security (permits only INSERT for the application role)
ALTER TABLE audit_log ENABLE ROW LEVEL SECURITY;
CREATE POLICY audit_log_insert_only ON audit_log
FOR INSERT TO app_role WITH CHECK (true);
-- No SELECT/UPDATE/DELETE policies for app_role
After adding the constraint, search all migrations in supabase/migrations/ for any UPDATE audit_log or DELETE FROM audit_log statements and remove them. Treat any future PR that adds such a statement as a critical security review item.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Compliance & Consent Engine Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- gdpr · Art. 5(2) — Accountability principle — audit trail must be tamper-resistant to be evidential
- cwe · CWE-472 — External control of assumed-immutable web parameter
- cwe · CWE-778 — Insufficient logging — mutable log has no evidentiary value
- iso-27001:2022 · A.8.15 — Logging — log integrity and protection
- nist:rev5 · AU-9 — Protection of audit information
Taxons
History
- 2026-04-18·v1.0.0·Initial import from compliance-consent-engine·automated