Sensitive operations are recorded in an audit log
Why it matters
PCI-DSS Req 10.2 mandates logging of all access to payment-related system components, including who performed actions and when. SOC 2 CC7.2 requires detection and logging of security-relevant activities. CWE-778 covers the failure directly: sensitive operations performed without an audit trail leave you unable to answer the most common post-incident questions — "when did this role change happen?", "who approved this data export?", "what did this admin do?" Application logs are insufficient because they are ephemeral, mutable, and not designed for forensic analysis. OWASP A09 identifies missing audit trails as a primary monitoring failure. A breach investigation without an audit log typically takes 3–5x longer and often cannot establish the timeline of events at all.
Severity rationale
Critical because sensitive operations without an audit trail cannot be forensically reconstructed after a security incident, and the absence violates PCI-DSS Req 10.2 and SOC 2 CC7.2 directly.
Remediation
Create a persistent audit_events table and call an insert function from every handler that performs a sensitive operation.
Minimum schema:
CREATE TABLE audit_events (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
actor_id UUID REFERENCES users(id),
action TEXT NOT NULL, -- e.g. 'user.role.changed'
resource TEXT NOT NULL, -- e.g. 'user', 'subscription'
resource_id TEXT NOT NULL,
metadata JSONB, -- old/new values, IP address, etc.
ip_address INET
);
Call it from sensitive handlers:
await createAuditEvent({
actorId: session.user.id,
action: 'subscription.cancelled',
resource: 'subscription',
resourceId: subscriptionId,
metadata: { reason: body.reason }
})
Target handlers: role changes, account deletion, subscription changes, payment processing, data exports, and all admin API calls. Application logs alone — even structured ones — do not satisfy this requirement.
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 Logging & Monitoring Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-778 — Insufficient Logging
- owasp:2021 · A09 — Security Logging and Monitoring Failures
- nist:rev5 · AU-2 — Event Logging
- pci-dss:4.0 · Req 10.2 — Audit logs capture all individual user access to cardholder data
- soc2:2017 · CC7.2 — Monitor system components for anomalies and incidents
Taxons
History
- 2026-04-18·v1.0.0·Initial import from saas-logging·automated