fix: Implement fixes for module routing and audit trail issues #949-952 - #1046
Merged
Mac-5 merged 4 commits intoJul 28, 2026
Merged
Conversation
added 4 commits
July 28, 2026 06:12
…od.rs Previously, src/handlers/webhook_refactored.rs was a fully-implemented webhook handler rewrite with improved code structure, reusable validation functions, and better error handling, but it was never declared as a module in handlers/mod.rs. This meant the module was never compiled into the binary despite containing 331 lines of refactored code. This commit declares the previously orphaned module, making it part of the compilation and allowing the refactored webhook handlers to be imported and used throughout the application. Test: Verify WebhookTransactionRequest from the refactored module compiles and can be instantiated, confirming the module is now part of the binary.
…in/mod.rs Previously, src/handlers/admin/audit.rs and compliance.rs were fully implemented but never declared in admin/mod.rs. This meant: - AuditSearchQuery and audit-log search functionality (241 lines) was unreachable - Compliance report generation (60 lines) was unreachable - Neither module compiled into the binary despite containing production code This resulted in audit-log search/export and compliance report endpoints being entirely non-functional in the running service. This commit declares both modules, making them part of the compilation and enabling their respective HTTP endpoints to be properly mounted and used. Tests: Verify that audit and compliance modules are declared and compilation succeeds with all admin submodules present.
…in admin_router Previously, dlq_routes() and webhook_replay_routes() were fully implemented but never mounted in create_app(), leaving critical operational endpoints inaccessible: - Dead-letter queue inspection (list_dlq) - Transaction requeue operations (requeue_dlq) - Failed webhook listing (list_failed_webhooks) - Webhook replay operations (replay_webhook, batch_replay_webhooks) - Webhook endpoint rate-limiting These routes have existing implementations with audit logging and transaction tracking, but no way to invoke them in the running service. This commit nests both route builders into the admin_router, making them available at: - `/admin/dlq` and `/admin/dlq/:id/requeue` (transaction DLQ operations) - `/admin/webhooks/failed`, `/admin/webhooks/replay/:id`, etc. (webhook ops) All routes remain protected by admin_auth middleware. Test: Routes now compile into the admin_router; if create_app() compiles without errors, the routes are properly mounted and reachable.
…atus audit trail Previously, the PATCH /admin/settlements/:id/status endpoint accepted an optional 'actor' field from the request body and persisted it directly into the settlement audit/history trail. Since the endpoint is protected only by a shared admin bearer token (not per-admin identity), this allowed any admin token holder to: - Impersonate specific colleagues in audit logs - Hide who actually made changes by using generic/fake actor names - Compromise the accountability that audit trails provide This commit removes validation of the actor field and makes the handler ignore any client-supplied value, always using "admin" server-side. The actor field remains in the request struct for backwards compatibility with existing clients that may be sending it, but it is: - No longer validated (validation removed) - No longer used (handler ignores the client value) - Always set to "admin" server-side This prevents audit trail spoofing until per-admin identity is implemented. Tests: Verify that: 1. Actor field with extremely long values passes validation (not validated) 2. Validation results are identical with or without actor field 3. Actor field presence/value doesn't affect validation outcome
|
@goldemaverick-ui 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! 🚀 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR implements fixes for 4 critical issues where implemented functionality was unreachable or insecure:
Issue #949: Add webhook_refactored module to handlers
src/handlers/webhook_refactored.rs(331 lines) was never declared as a moduleIssue #950: Declare audit and compliance modules in admin
src/handlers/admin/audit.rs(241 lines) andcompliance.rs(60 lines) were never declaredIssue #951: Mount dlq_routes and webhook_replay_routes in create_app()
/admin/dlq,/admin/dlq/:id/requeue,/admin/webhooks/failed,/admin/webhooks/replay/*Issue #952: Fix settlement status audit trail to not trust client-supplied actor
Test Coverage
Each fix includes unit tests to verify:
Closes #952
Closes #951
Closes #950
Closes #949