-
Notifications
You must be signed in to change notification settings - Fork 72
feat(audit): tamper-evident audit log for security/financial actions with admin query API #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
zeemscript
merged 14 commits into
Deen-Bridge:dev
from
emarc99:feat/66-tamper-evident-audit-log-fin-sec-actions
Jul 29, 2026
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6742154
fix: prevent IDOR in user profile endpoints
mayborn005 b768dd2
feat: add Horizon payment ingestion worker with automated reconciliation
mayborn005 30efbdc
Merge pull request #83 from mayborn005/fix/horizon-payment-ingestion-…
zeemscript b464b6f
Merge branch 'main' into fix/idor-user-profile-authorization
zeemscript 12c62f1
Merge pull request #82 from mayborn005/fix/idor-user-profile-authoriz…
zeemscript cd4153c
feat(audit): add append-only AuditLog model with AUDIT_ACTIONS enum
emarc99 76a182e
feat(audit): add non-blocking auditService with allowlist redaction
emarc99 a27218b
feat(audit): instrument authController with structured audit events
emarc99 14d2c42
feat(audit): instrument walletController with structured audit events
emarc99 1b1903d
feat(audit): instrument paymentController with structured audit events
emarc99 8488048
feat(audit): add read-only admin audit query API at /api/admin/audit
emarc99 1ecbdd2
test(audit): add Jest+supertest suite 21 tests, all passing- redactM…
emarc99 f60fdcc
Merge branch 'dev' into feat/66-tamper-evident-audit-log-fin-sec-actions
emarc99 9579a53
fix(audit): guard auditService against Mongoose buffer timeouts and f…
emarc99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import { getReconciliationStatus } from "../../services/stellar/reconciliationService.js"; | ||
| import logger from "../../config/logger.js"; | ||
|
|
||
| export const reconciliationStatus = async (req, res) => { | ||
| try { | ||
| const status = await getReconciliationStatus(); | ||
| res.status(200).json({ | ||
| success: true, | ||
| ...status, | ||
| }); | ||
| } catch (error) { | ||
| logger.error("Get reconciliation status error:", error); | ||
| res.status(500).json({ | ||
| success: false, | ||
| message: "Failed to fetch reconciliation status", | ||
| }); | ||
| } | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Missing audit coverage: Stellar submission errors never reach the audit log.
PAYMENT_SUBMIT_FAILEDis correctly recorded here for on-chain verification failures, but the siblingcatch (stellarError)branch a few lines above (around line 577-592) — which also marks the transaction"failed"with afailureReasonand returns a 400 — has norecordAuditcall at all. Since Stellar submission errors (bad signature, insufficient funds, network rejection, etc.) are a distinct and common payment failure mode, this leaves a real gap in the financial audit trail that issue#66asks for.🛡️ Proposed fix: audit the Stellar submission failure branch too
} catch (stellarError) { // Handle Stellar submission errors transaction.status = "failed"; transaction.failureReason = stellarError.message; await transaction.save({ session }); await session.commitTransaction(); paymentsFailed.inc({ type: "purchase", reason: "stellar_error" }); logger.error(`Transaction ${transactionId} failed:`, stellarError); + recordAudit({ + action: AUDIT_ACTIONS.PAYMENT_SUBMIT_FAILED, + actor: buyerId, + req, + targetType: "Transaction", + targetId: transactionId, + status: "failure", + metadata: { + transactionId, + failureReason: stellarError.message, + }, + }); + return res.status(400).json({ success: false, message: "Transaction failed on Stellar network", error: stellarError.message, }); }🤖 Prompt for AI Agents