Docs / Privacy & Compliance / Integrity

Integrity

Add an HMAC hash to each entry, then detect an entry that was changed after it was written.

Enable integrity

The secret must have at least 32 bytes:

config/packages/symfonycorp_audit_log.yaml
symfonycorp_audit_log:
    integrity:
        secret: '%env(AUDIT_LOG_SECRET)%'
        algorithm: sha256

Check the entries

terminal
$ bin/console audit-log:verify
$ bin/console audit-log:verify --output=dbal

The command exists only when integrity is enabled. It reads every entry. It reports an entry that it cannot read, for example a context with invalid JSON, as a violation. It exits with a non-zero code when it finds a violation. Run it on a schedule and alert on this code.

The EasyAdmin detail page shows the result of one entry as a badge: Verified, Tampered, Missing hash, Cannot verify or Not protected.

Limits