Skip to main content

Audit Trail Design

Status: DRAFT Owner: Engineering Last Review: 2026-02-21 Applicable Standards: SOC 2 (CC4.1, CC4.2, CC7.2, CC7.3) / GDPR (Art. 30) / SEC (recordkeeping)

1. Purpose

This document describes the audit trail mechanisms in the Equa platform — how user actions, system events, and AI agent operations are recorded, stored, and surfaced. It identifies gaps in the current implementation and recommends improvements to meet SOC 2, GDPR, and SEC recordkeeping requirements.

2. Scope

For the full technical architecture, see Event and Activity Model.

3. Current Implementation

The platform uses a dual audit system: structured Actions for high-level user operations and flexible EventLogs for detailed event records.

3.1 Actions Table

Source: equa-server/modules/persistence/src/schema.ts (Actions entity) Key characteristics:
  • Content-addressable: The hash-based primary key means identical actions produce the same hash, providing implicit deduplication
  • Immutable by design intent: The HashedTable base class uses the hash as the primary key, making updates semantically incorrect (a modified record would have a different hash). However, DELETE operations are not prevented at the database level
  • No payload field: The Actions table stores only the action type UUID — detailed context must be correlated from other sources

3.2 EventLogs Table

Source: equa-server/modules/persistence/src/schema.ts (EventLogs entity) Key characteristics:
  • Flexible schema: The data JSON field can store any structured payload, making it adaptable to new event types without schema migrations
  • Mutable: Both created and modified timestamps exist, and the record can be updated or deleted
  • Semi-queryable: JSON payloads can be queried via PostgreSQL JSON operators, but there are no dedicated indexes on the data field

3.3 Activity Flow

3.4 Activity API Endpoints

Source: equa-server/modules/api/src/endpoints/activity-endpoints.ts

4. Agent Audit Logger

Source: equa-server/modules/agent/src/security/guardrails.ts The AI agent (Equanaut) has a dedicated audit logger that records all tool executions with enhanced detail.

4.1 Logged Fields

4.2 Sensitive Field Sanitization

Before logging tool arguments, the audit logger redacts values for fields matching these patterns: Sanitized fields are replaced with [REDACTED] in the log output.

4.3 Agent Rate Limit Logging

The guardrails system also logs rate limit events:

4.4 Browser Automation Audit (Comet-Bridge)

Source: Comet-Bridge/scripts/browser-audit.mjs, Comet-Bridge/scripts/audit-logger.mjs Comet-Bridge, the browser automation layer used by Equanaut for web-based tasks, maintains its own audit trail independently of the server-side audit system. This is a local-runtime audit surface that records all browser automation sessions and lifecycle events.

Lifecycle Event Types

The browser automation audit captures five lifecycle event types: Each event file contains the full lifecycle envelope (task-thread ID, run ID, status, timestamps, route, agent ID, and failure reason where applicable).

PII Masking Rules

Browser automation sessions may capture screenshots and action logs that contain sensitive content. The following masking rules apply:

Dual-Stream Architecture

Lifecycle events are written to two parallel audit streams simultaneously: The runId field cross-links both streams, enabling complete reconstruction of a browser automation run from either the session directory or the run JSONL.

5. Frontend Display

Source: equa-web/src/modules/organization-dashboard/ The organization dashboard displays recent actions for the active organization, providing visibility into team activity. This is a read-only view that queries the activity API endpoints.

6. Audit Trail Gaps

6.1 Mutability

Both actions and event_logs tables allow UPDATE and DELETE operations at the database level. While the HashedTable pattern for Actions discourages updates (the hash would change), there is no technical enforcement preventing deletion of audit records.Risk: An attacker with database access could delete or modify audit records to cover their tracks.

6.2 No Before/After State Tracking

Neither audit system captures the state of an entity before and after a change. For example, when a shareholding is modified, the log records that a change occurred and who made it, but not what the previous values were.Risk: Forensic investigation of unauthorized changes requires correlating multiple data sources and cannot definitively reconstruct the state at a given point in time.

6.3 No Comprehensive Coverage

Not all state-changing operations in the platform trigger audit log entries. The audit system is opt-in — each endpoint must explicitly call the activity module to create records.Risk: Some operations may not be captured, creating blind spots in the audit trail.

6.4 No Log Export or Compliance Reporting

There is no mechanism to export audit logs in a standardized format (e.g., CSV, SIEM-compatible JSON) or to generate compliance reports from the audit data.Risk: Manual effort required for audit preparation and regulatory reporting.

6.5 No External Log Shipping

Audit logs are stored only in the application database. There is no log shipping to external, append-only storage (e.g., AWS CloudWatch, Datadog, Splunk).Risk: If the database is compromised, all audit data is compromised.

6.6 No Real-Time Alerting

There is no real-time monitoring or alerting on audit events. Suspicious patterns (e.g., bulk data access, privilege escalation, off-hours activity) are not detected automatically.Risk: Security incidents may go undetected until manual review.

7.1 Priority 1: Immutable Audit Storage

7.2 Priority 2: External Log Shipping

7.3 Priority 3: Comprehensive Coverage

7.4 Priority 4: Monitoring and Alerting

7.5 Priority 5: Export and Reporting

8. What Should Be Audited

For SOC 2 and SEC compliance, the following events should be captured in the audit trail:

9. Regulatory References

10. Revision History