Skip to content

Persist audit actions to a tamper-evident hash-chained store - #1028

Open
pavsoss wants to merge 1 commit into
Userunknown84:mainfrom
pavsoss:feat/1023-audit-store
Open

Persist audit actions to a tamper-evident hash-chained store#1028
pavsoss wants to merge 1 commit into
Userunknown84:mainfrom
pavsoss:feat/1023-audit-store

Conversation

@pavsoss

@pavsoss pavsoss commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Part 1 of 2 for #1023. Audited actions were only written as free-text log
lines — editable after the fact and impossible to query. This adds a durable
audit store backed by SQLite (no new dependencies) that links every record
into a SHA-256 hash chain: each record commits to the hash of the one before
it, so editing or deleting any record invalidates every hash that follows. A
verify_chain routine recomputes the chain and reports whether the trail is
intact.

The existing audit_log decorator now persists a structured record — actor,
action, resource, correlation id, resulting status and a UTC timestamp — in
addition to the log line it already writes. Persistence is fail-soft: a store
failure is logged and swallowed so it can never turn a successful request into
an error. The database location is configurable via AUDIT_DB_PATH.

Parts

Test plan

Regression coverage for appending records and confirming the chain verifies,
plus proof that a field edit, a status edit and an interior row deletion are
each detected as tampering.

Refs #1023

@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

@pavsoss is attempting to deploy a commit to the Aditya Sharma's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant