UAT: Audit log schema missing spec-required fields: event_id (ULID), actor_id, signature #5809

Open
opened 2026-04-09 10:02:40 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: Audit Logging — Data Model / Schema
Milestone: v3.5.0 (M6)
Severity: Critical — schema non-compliance breaks cryptographic verifiability requirement

What Was Tested

The AuditLogEntry data class and AuditLogModel database schema were inspected against the specification's required audit log JSON schema.

Expected Behavior (from spec)

The specification defines a mandatory audit log entry schema with these required fields:

event_id     (ULID)
timestamp    (ISO 8601)
event_type   (e.g., plan.created, tool.invoked)
actor_id
user_id
plan_id
details      (nested object with event-specific data)
signature    (cryptographic signature of the entry)

The spec also states:

An immutable, cryptographically verifiable audit trail must log every significant event.

Actual Behavior

The current AuditLogEntry dataclass (src/cleveragents/application/services/audit_service.py) has:

@dataclass(slots=True)
class AuditLogEntry:
    id: int          # Auto-increment integer, NOT a ULID
    event_type: str
    plan_id: str | None
    project_name: str | None
    actor_name: str | None   # String name, NOT actor_id
    user_identity: str | None  # String, NOT user_id
    details: dict[str, Any]
    created_at: str

Missing fields:

  1. event_id — The spec requires a ULID for each audit entry. The implementation uses an auto-increment integer id instead. This breaks lexicographic time-ordering and global uniqueness guarantees.
  2. actor_id — The spec requires actor_id (a structured identifier). The implementation stores actor_name (a plain string).
  3. signature — The spec requires a cryptographic signature for each entry to ensure immutability and verifiability. No signature field exists anywhere in the implementation.

The database schema (CREATE TABLE audit_log) also lacks these columns.

Code Location

  • src/cleveragents/application/services/audit_service.pyAuditLogEntry dataclass
  • src/cleveragents/infrastructure/database/models.pyAuditLogModel SQLAlchemy model
  • src/cleveragents/infrastructure/database/models.pyaudit_log table DDL

Impact

  1. No cryptographic verifiability: Without signature, the audit log cannot be used for compliance purposes where tamper-evidence is required.
  2. No ULID-based event identity: Integer IDs are not globally unique and cannot be used for distributed audit log correlation.
  3. Schema divergence from spec: Any tooling built against the spec's documented schema will fail against the actual implementation.

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Feature Area**: Audit Logging — Data Model / Schema **Milestone**: v3.5.0 (M6) **Severity**: Critical — schema non-compliance breaks cryptographic verifiability requirement ### What Was Tested The `AuditLogEntry` data class and `AuditLogModel` database schema were inspected against the specification's required audit log JSON schema. ### Expected Behavior (from spec) The specification defines a mandatory audit log entry schema with these required fields: ``` event_id (ULID) timestamp (ISO 8601) event_type (e.g., plan.created, tool.invoked) actor_id user_id plan_id details (nested object with event-specific data) signature (cryptographic signature of the entry) ``` The spec also states: > An immutable, cryptographically verifiable audit trail must log every significant event. ### Actual Behavior The current `AuditLogEntry` dataclass (`src/cleveragents/application/services/audit_service.py`) has: ```python @dataclass(slots=True) class AuditLogEntry: id: int # Auto-increment integer, NOT a ULID event_type: str plan_id: str | None project_name: str | None actor_name: str | None # String name, NOT actor_id user_identity: str | None # String, NOT user_id details: dict[str, Any] created_at: str ``` **Missing fields:** 1. `event_id` — The spec requires a ULID for each audit entry. The implementation uses an auto-increment integer `id` instead. This breaks lexicographic time-ordering and global uniqueness guarantees. 2. `actor_id` — The spec requires `actor_id` (a structured identifier). The implementation stores `actor_name` (a plain string). 3. `signature` — The spec requires a cryptographic signature for each entry to ensure immutability and verifiability. **No signature field exists anywhere in the implementation.** The database schema (`CREATE TABLE audit_log`) also lacks these columns. ### Code Location - `src/cleveragents/application/services/audit_service.py` — `AuditLogEntry` dataclass - `src/cleveragents/infrastructure/database/models.py` — `AuditLogModel` SQLAlchemy model - `src/cleveragents/infrastructure/database/models.py` — `audit_log` table DDL ### Impact 1. **No cryptographic verifiability**: Without `signature`, the audit log cannot be used for compliance purposes where tamper-evidence is required. 2. **No ULID-based event identity**: Integer IDs are not globally unique and cannot be used for distributed audit log correlation. 3. **Schema divergence from spec**: Any tooling built against the spec's documented schema will fail against the actual implementation. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.5.0 milestone 2026-04-09 10:26:10 +00:00
Author
Owner

Label compliance fix applied:

  • Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Label compliance fix applied: - Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#5809
No description provided.