Skip to content

feat: public witness for audit log Merkle roots (#721) - #797

Open
Bug00Joe wants to merge 1 commit into
RevoraOrg:masterfrom
Bug00Joe:feat/audit-merkle-public-witness
Open

feat: public witness for audit log Merkle roots (#721)#797
Bug00Joe wants to merge 1 commit into
RevoraOrg:masterfrom
Bug00Joe:feat/audit-merkle-public-witness

Conversation

@Bug00Joe

@Bug00Joe Bug00Joe commented Aug 1, 2026

Copy link
Copy Markdown

Overview

This PR publishes the Merkle root of each day's audit log to a public witness (Stellar memo / mock), persists the receipt, and retries with bounded backoff. Witness downtime never breaks local hash-chain integrity verification.

Related Issue

Closes #721

Changes

🔐 Public witness for audit Merkle roots

  • [ADD] src/security/auditMerkle.ts — pure Merkle helpers (computeMerkleRoot, utcDayBounds).
  • [MODIFY] src/security/witnessClient.tsMockWitnessClient + StellarMemoWitnessClient (injectable Horizon submitter; dry-run by default).
  • [MODIFY] src/security/auditWitnessPublisher.ts
    • publishDayRoot() loads the day's row_hash values, computes the Merkle root, publishes with exponential backoff, persists receipt.
    • publishLatest() still publishes the chain head after a successful integrity check.
    • Failures emit audit.witness.publish_errors + ALARM and are swallowed.
  • [MODIFY] src/security/auditIntegrityScheduler.ts — nightly job calls publishDayRoot() + publishLatest().
  • [ADD] tests + docs/audit-merkle-public-witness.md.

Receipts land in audit_witness_receipts (migration 018).

Verification Results

npx jest src/security/auditMerkle.test.ts src/security/auditWitnessPublisher.test.ts src/security/auditIntegrityScheduler.test.ts --forceExit
✅ 24/24 passed
Acceptance Criteria Status
Periodic job computes day's Merkle root publishDayRoot()
Posts to public witness (Stellar memo / mock)
Persist receipts with root + timestamp audit_witness_receipts
Emit audit.witness.published
Failed publishes retry with bounded backoff + alert
Witness downtime does not break local integrity ✅ errors swallowed

Timeline

  • Implemented day-scoped Merkle root + witness publisher + Stellar client + docs/tests.

Add day-scoped Merkle root computation over audit row_hashes, publish
to a public witness (Stellar memo / mock) with bounded retry+backoff,
and persist receipts. Witness downtime never breaks local integrity.
Emits audit.witness.published on success.
@drips-wave

drips-wave Bot commented Aug 1, 2026

Copy link
Copy Markdown

@Bug00Joe Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Audit-log integrity proofs: publish Merkle root to a public witness periodically

1 participant