Skip to main content
Attesta ships with a built-in SHA-256 hash-chained JSONL audit logger, but also supports TrailProof as an alternative audit backend. TrailProof is a standalone, zero-dependency library purpose-built for tamper-evident event logging with HMAC signing, multi-tenancy, trace correlation, and cursor-based queries.

Why TrailProof?

The legacy audit backend (Attesta’s built-in logger) provides basic hash-chaining and verification. TrailProof adds:
  • HMAC signatures for cryptographic provenance
  • Multi-tenancy isolation via tenant IDs
  • Trace correlation for distributed workflows
  • Cursor-based pagination for large audit logs
  • Pluggable storage (in-memory or JSONL)
  • Production-grade features maintained as a dedicated library
Both backends are fully supported. The legacy backend remains the default and will continue to receive updates. TrailProof is optional and requires an additional package installation.

Installation

TrailProof is an optional dependency. Install it alongside Attesta:
If you configure audit.backend: trailproof without installing the package, Attesta will raise an ImportError at initialization with clear installation instructions.

Configuration

Enable TrailProof by setting audit.backend in your attesta.yaml:
attesta.yaml
Store your HMAC key in an environment variable and reference it in your code, not directly in the YAML file. TrailProof supports reading the key at initialization.

Field Mapping

TrailProof uses a 10-field event envelope. Attesta audit fields are mapped as follows:

Event Type Convention

The event_type field follows the pattern attesta.approval.{verdict}, producing values like:
  • attesta.approval.approved
  • attesta.approval.denied
  • attesta.approval.auto_approved
  • attesta.approval.timed_out
This convention allows you to filter events by approval outcome in TrailProof queries.

Usage Examples

Python

TypeScript


Verifying Integrity

TrailProof provides the same verification guarantees as the legacy backend, but uses its own hash-chaining and signature algorithms.

What Verification Detects

Chain verification is a forward-only operation. It can detect tampering but cannot recover the original data. For production use, consider replicating the audit log to an immutable store (S3 with Object Lock, append-only databases, etc.).

Querying Events

TrailProof provides a query API that supports filtering by actor, tenant, event type, and more. The Attesta backend adapter exposes a simplified query interface:
For advanced queries (filtering by tenant, trace, cursor-based pagination), use the TrailProof library directly. The Attesta backend adapter provides a simplified interface for common use cases.

Multi-Tenancy

TrailProof supports multi-tenancy isolation via tenant IDs. All events logged by a TrailProof backend are tagged with the tenant_id configured at initialization.
attesta.yaml
This allows you to:
  • Store audit logs for multiple tenants in the same file
  • Filter events by tenant in queries
  • Maintain separate integrity chains per tenant
If you’re deploying Attesta in a multi-tenant SaaS application, set the tenant_id dynamically based on the current request context. The TrailProof backend can be initialized per-tenant or reconfigured at runtime.

HMAC Signing

TrailProof supports HMAC signatures for cryptographic provenance. When you provide an hmac_key, every event is signed with HMAC-SHA256, and verification checks both hash integrity and signature validity.
attesta.yaml
Never commit your HMAC key to version control. Store it in an environment variable and read it at initialization:

Migration from Legacy Backend

Audit trails are stored as independent JSONL files. When you switch from legacy to trailproof, Attesta will start writing to a new TrailProof-formatted log. Your existing legacy audit log remains intact and can still be verified using the LegacyBackend.

Migration Strategy

  1. Keep both logs during transition:
    Your old .attesta/audit.jsonl remains unchanged.
  2. Verify the legacy log one last time:
  3. Archive the legacy log to immutable storage.
  4. Switch to TrailProof for all new events.
There is no automatic migration tool to convert legacy JSONL entries into TrailProof format. The two backends use different field structures and hash algorithms. If you need to analyze both logs together, export them to a common format (CSV, JSON) using Attesta’s exporter utilities.

Comparison: Legacy vs TrailProof


Example Audit Entry

Here’s what a TrailProof-backed audit entry looks like in the JSONL file:

Audit Trail Concepts

Understand audit trail fundamentals and hash-chaining

Production Deployment

Best practices for deploying Attesta in production