Install

Works with Drupal: ^10.6 || ^11.3

Using Composer to manage Drupal site dependencies

Alternative installation files

Download tar.gz 23.05 KB
MD5: f2a644fedb6d72d2496e95e12600d28c
SHA-1: 0a915e8b43c8cf3df7f81757b23e036105596211
SHA-256: 85b2db1986f4390711f43d6fb53a7bdbda02bb6ef26a412fee603e566feefce3
Download zip 31.97 KB
MD5: de538a1b3eff871deb53b6b557a7ac8e
SHA-1: 9af9d44235e7c66114a188dffd88b0f4a756e9aa
SHA-256: 5cca6c31821b59206c176147a577d9165efc68707d7bb6a4d6ca2ef6aea0d678

Release notes

First stable release of Audit Chain: tamper-evident, hash-chained audit logging that any Drupal module can write to.

Each entry's hash covers its own content and the previous entry's hash, so a later insertion, deletion or edit breaks the chain and is detectable by an independent verification pass. With an HMAC key configured, forging a repair also requires the key — an edit made straight in the database cannot be quietly papered over.

Provenance

This is not new code. The chain was extracted from MCP Sentinel 1.13, where it had run in production as the audit trail for AI-agent traffic, and the behaviour is carried over unchanged: the same canonical payload and key order, the same HMAC-SHA256 over prev_hash|canonical with a plain SHA-256 fallback, encryption applied after hashing so enabling it later does not invalidate earlier entries, and the same append lock preventing two concurrent writers from forking the chain.

It was extracted because the capability was never specific to AI agents. Personnel-record reads, permission grants, configuration changes and break-glass logins all want the same guarantee, and none of them should have to install an AI-governance module to get it. MCP Sentinel remains its first consumer.

What is in it

  • AuditChainLoggerInterface and its implementation, writing to the audit_chain_log table. Consumers are identified by a channel, which is bound into the row hash so an entry cannot be re-attributed to a different channel after the fact.
  • Optional HMAC signing via a Key entity, and optional at-rest encryption of entry metadata via an Encryption Profile.
  • drush audit-chain:verify — walks every entry and verifies the chain. The exit code is the contract: non-zero meany, so it can be wired into monitoring ora deploy gate without parsing output.
  • A settings form at Configuration → System → Audit Chain for the signing key, the encryption profile, and streaming entries to the audit_chain logger channel for a SIEM.

API stability

The 1.x contract is AuditChainLoggerInterface: verify(),decodeMetadata() and prune(). verify() deliberately takes no channel argument — the chain is global, entries from every consumer are interleaved in one sequence, so a single channel cannot be verified in isolation without the entries between its own, and a per-channel walk could not tell a deletion from a gap. A

Two constraints forconsumers

Do not log per access check. A hook such as hook_entity_field_access() fires per field, per entity, per render; an entry each time producea chain nobody can read and a write-amplrequest and flush once atkernel.terminate.

Rotating the encryption profile orphans existing entries. The chain is computed over the plaintext, so entries encrypted under the previous profilestop verifying — and the failure lg. Export or re-encrypt first.

What it does not do

  • It does not make deletion impossible. Nothing at the application layer can; it makes deletion evident, as a seam at the next verification.
  • It does not order events acrosservers. The chain is one sequence in ons not replace dblog or syslog. Those areoperational logs; this is an evidentiary one, and deliberately narrower.

Verified

The kernel suite runs on Drupal 10.6, 11.3 and 11 (PHPUnit 9.6 and 11.5), and covers chain verification, detection of an edited entry, a deleted channel, keyed versus unkeyed chains,channel-scoped pruning, and compatibility with entries migrated from a consumer's own table. Drupal coding standards are enforced in CI.

Insser requiredrupal/audit_chain

Requires Drupal 10.6+ or 11.3+, Encrypt.

Created by: jmcerda
Created on: 29 Jul 2026 at 20:11 UTC
Last updated: 29 Jul 2026 at 20:12 UTC
Unsupported

Other releases