ATStatus
ATStatus WikiLoading documentation...

Audit Trail

✓ Tamper-Proof Implementation

ATStatus includes an enterprise-grade audit logging system with hash chain verification, ensuring complete traceability and tamper evidence for all administrative actions.

Why Hash Chains?

Each audit event includes a cryptographic hash that depends on the previous event's hash. This creates an unbreakable chain — if anyone modifies a past entry, all subsequent hashes become invalid, immediately exposing tampering.

How the Audit Trail Works

┌─────────────────────────────────────────────────────────────┐
│                     Audit Event Chain                        │
├─────────────────────────────────────────────────────────────┤
│                                                              │
│  Event #1          Event #2          Event #3               │
│  ┌──────────┐     ┌──────────┐     ┌──────────┐            │
│  │ Action   │     │ Action   │     │ Action   │            │
│  │ Actor    │     │ Actor    │     │ Actor    │            │
│  │ Time     │     │ Time     │     │ Time     │            │
│  │ Hash: A  │────▶│ Hash: B  │────▶│ Hash: C  │────▶ ...  │
│  │ Prev: ∅  │     │ Prev: A  │     │ Prev: B  │            │
│  └──────────┘     └──────────┘     └──────────┘            │
│                                                              │
│  If Event #1 is modified, Hash A changes,                   │
│  which invalidates Hash B, Hash C, and all subsequent.      │
└─────────────────────────────────────────────────────────────┘

What Gets Logged

The audit system captures all significant administrative actions:

Authentication Events
  • • User login (success/failure)
  • • Logout
  • • Password changes
  • • 2FA enable/disable
  • • Session creation/revocation
User Management
  • • User created
  • • User modified (role changes, etc.)
  • • User deactivated/deleted
  • • Permission changes
Status Page Operations
  • • Component created/modified/deleted
  • • Incident created/updated/resolved
  • • Maintenance scheduled/completed
  • • Status page settings changed
System Operations
  • • API key created/deleted
  • • Feature toggles changed
  • • Cache cleared
  • • Data exports performed

Audit Event Structure

Each audit event contains the following information:

FieldDescriptionExample
idUnique event identifierevt_abc123
timestampWhen the event occurred2024-01-15T14:30:00Z
severityEvent severity levelINFO, WARNING, CRITICAL
eventTypeType of action performedUSER_LOGIN, INCIDENT_CREATE
domainFunctional areaAUTH, INCIDENT, USER
actorIdUser who performed actionuser_xyz789
actorEmailActor's email addressadmin@example.com
entityTypeType of entity affectedIncident, Component
entityIdID of affected entityinc_def456
changesWhat was changed (JSON){"status": ["investigating", "resolved"]}
ipAddressRequest origin IP192.168.1.100
userAgentBrowser/client infoMozilla/5.0...
hashCryptographic hashsha256:abc...
prevHashPrevious event's hashsha256:xyz...

Severity Levels

INFONormal operations — logins, data reads, routine actions
WARNINGSignificant changes — config changes, role modifications, data updates
CRITICALSecurity events — failed logins, user deletion, permission escalation attempts

Accessing Audit Logs

Admin Panel

Access audit logs at /admin/audit. The interface provides:

  • Filtering: By date range, severity, event type, user, entity
  • Search: Full-text search across event data
  • Detail View: Expand events to see full change details
  • Export: Download logs in JSON or CSV format

Sensitive Data Access

Permission Required

IP addresses, user agents, and other sensitive metadata are only visible to users with the AUDIT_VIEW_SENSITIVE permission. This is granted to OWNER and ADMIN roles by default.

Tamper Detection

The hash chain provides automatic tamper detection. If anyone attempts to modify a historical audit entry:

  1. The modified entry's hash would change
  2. The next entry's prevHash would no longer match
  3. All subsequent entries become invalid
  4. The chain break is detectable by validating hashes
// Hash verification pseudocode
function verifyChain(events) {
  for (let i = 1; i < events.length; i++) {
    const expectedPrevHash = computeHash(events[i-1]);
    if (events[i].prevHash !== expectedPrevHash) {
      return { valid: false, brokenAt: i };
    }
  }
  return { valid: true };
}

Compliance Benefits

SOC 2
CC7.1, CC7.2, CC7.3
ISO 27001
A.8.15, A.8.16
GDPR
Article 30

Log Retention

By default, audit logs are retained indefinitely. For compliance with data retention policies, you can implement log archival or deletion procedures:

  • Export logs before deletion for archival
  • Consider regulatory requirements (some require 7+ years retention)
  • Database cleanup can be done via Prisma or direct SQL
Best Practice

Export audit logs monthly and store in a separate, secure location. This provides backup and allows database cleanup while maintaining compliance.