Skip to content

feat: add tamper-evident activity audit log - #315

Merged
Lakes41 merged 2 commits into
Adamantine-guild:mainfrom
LuisD-Dev:branchotoworkissue
Jul 29, 2026
Merged

feat: add tamper-evident activity audit log#315
Lakes41 merged 2 commits into
Adamantine-guild:mainfrom
LuisD-Dev:branchotoworkissue

Conversation

@LuisD-Dev

Copy link
Copy Markdown
Contributor

Description

Adds tamper evidence to the durable activity audit log using a deterministic SHA-256 hash chain.

Each persisted activity entry is cryptographically bound to its canonical content and the previous entry's hash. An admin-only verification endpoint validates the stored chain and reports the first affected entry when historical activity data has been modified or deleted.

The feature is scoped to durable PostgreSQL activity storage. Existing mock, memory, file, and synthetic activity behavior remains unchanged.

Linked Issue

Closes #264

Type of Change

  • 🐛 Bug fix
  • ✨ New feature / enhancement
  • 📝 Documentation update
  • 🔧 Chore / refactor
  • 🧪 Tests only

Changes Made

  • Added deterministic canonical serialization and SHA-256 hash chaining for durable activity entries.
  • Added monotonic chain sequencing and concurrency-safe PostgreSQL writes to prevent chain forks during simultaneous activity inserts.
  • Added migration and deterministic backfill support for existing durable activity data.
  • Added chain verification that detects and localizes historical content changes, hash tampering, sequence gaps, predecessor mismatches, and deleted entries.
  • Added an admin-protected GET /api/activity/verify endpoint for integrity verification.
  • Routed durable activity writers through the shared hash-chain write path.
  • Added PostgreSQL security and concurrency tests.
  • Documented the hash-chain integrity model and the external anchoring limitation.
  • Kept mock, memory, file, synthetic activity, authentication roles, and unrelated business logic unchanged.

Test Evidence

Fresh PostgreSQL integration tests

16 passed
0 failed
0 skipped

@Lakes41
Lakes41 merged commit d4ff7ea into Adamantine-guild:main Jul 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement a tamper-evident, hash-chained activity/audit log

2 participants