The audit log

  • For IT
  • Bugsoft Portal 4.12.14

What Bugsoft Portal writes to the audit log, how the hash chain and the daily anchor work, what they do and do not prove, and how long the log is kept.

Every change that matters goes into the audit log: sign-ins and failed sign-ins, permissions and roles, settings, tiles, saved sign-in details (without the secrets themselves), password exports, deleted accounts, and retention periods that delete something.

You view it in Settings › System › Log (permission audit.view), with filters and a CSV download.

What each row contains

  • The time (UTC), the action (such as vault.export.completed), who did it (ID and name, or "system" for the scheduled tasks), and what it was about (kind, ID and a readable name).
  • The IP address and the browser (user agent) of whoever did it.
  • Details as JSON. Fields whose name looks like a secret (pass, secret, token, pin, _enc) are replaced by [redacted] before they are stored. Passwords and notes never go in.

The audit log is stored readable in the database: names, IP addresses and browsers are personal data. That is why there is a retention period (see below).

The hash chain

Each row gets an HMAC-SHA256 over the contents of that row and the hash of the row before it. The key is a subkey of APP_KEY. A changed, inserted or removed row in the middle breaks the chain.

  • To check it: php bin/console audit:verify, or Log › Verify now in Admin. The result goes into the audit log too.
  • Once a day, the task core.audit.anchor writes an anchor (the ID and hash of the last row) to storage/logs/audit-anchor.log and to the application log (audit.anchor). The check looks whether every anchored row is still in the chain. So it also shows when someone removes the newest rows and rolls the chain back.

What the chain does not prove

  • Someone with write access to the database can remove rows made after the last anchor (at most a day) without it being noticed.
  • Whoever also has APP_KEY can make a new, valid chain. Whoever can also change the anchor file can hide a chain that was rolled back.
  • The chain says nothing about what happens outside Bugsoft Portal, such as someone looking directly into the database.

Do you want the audit log to hold up against a server administrator too? Copy audit-anchor.log to another system regularly, or send the application log to a separate log server (LOG_CHANNEL=stderr or both, with a log shipper). Never change the anchor file. If it is gone, the check skips the anchors.

How long the audit log is kept

By default forever: audit.retention_days is 0. Choose a period in Settings › Statistics and retention › Keep the audit log (days). The nightly task then removes older rows, and writes the new start of the chain into the chain itself, so that this can be checked too. production:check warns as long as the period is 0.

Which period fits depends on your own policy. Think of the time in which you want to be able to investigate incidents (often 1 to 2 years), and the retention periods in your record of processing activities. See also Retention periods.

Note: when an account is deleted, that person's name stays in old rows of the audit log until the retention period removes them. The chain makes it impossible to change single rows.

Stuck? See Questions and problems or contact Bugsoft at ugurs156@gmail.com.