nside_wefa.audit.models

Tamper-evident LogEntry subclass.

When NSIDE_WEFA.AUDIT.TAMPER_EVIDENT is True, the settings translation layer points AUDITLOG_LOGENTRY_MODEL at WefaLogEntry, which adds two columns (prev_hash, hash) and computes a SHA-256 hash chain in a pre_save handler. The wefa_audit_verify() management command walks the chain forward and reports the first divergence.

The model is always defined and migrated — leaving the table empty when the feature is off costs nothing and means flipping the setting later does not require an additional migration.

Functions

compute_event_hash(entry, prev_hash)

Compute the SHA-256 hex digest for a log entry chained on prev_hash.

Classes

WefaLogEntry(*args, **kwargs)

LogEntry variant with a SHA-256 hash chain for tamper-evidence.