Documentation
¶
Overview ¶
Command chainaudit recomputes every audit_log_chain row against live data and classifies why it does or does not verify.
It exists because "the chain reports 80 breaks" is not actionable on its own. Rebaselining a tamper-evident chain re-signs whatever is there, so it erases evidence as readily as it clears noise. Before doing that we have to show that every break is explained by a known defect and none is an unexplained mismatch.
The known defect: ComputeAuditChainHash used to reduce the timestamp with Truncate(time.Microsecond) while PostgreSQL ROUNDS timestamptz to microseconds. Any timestamp whose nanosecond remainder was >= 500ns therefore hashed one value at write time and a different one at verify time. Fixed in api#361; this tool measures the wreckage that fix left behind.
Classification per row:
verifies - recomputes to the stored hash with the current (Round) code
legacy truncate - matches at stored_ts-1us => the #79..#361 truncate/round bug
pre-#79 - matches once the lost sub-microsecond remainder is brute
forced back => the original nanosecond-precision hash
UNEXPLAINED - matches under none of the above. This is the one that matters:
a row here is either a defect nobody has characterized yet or
an actual tamper, and rebaselining would erase the difference.