protect admin endpoints with wallet allowlist#104
Open
Obiajulu-gif wants to merge 2 commits into
Open
Conversation
23 tasks
Obiajulu-gif
marked this pull request as ready for review
July 22, 2026 15:17
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.
Related Issue
Closes #97
Title
Protect privileged API endpoints with a fail-closed wallet allowlist.
Description
The audit-log endpoint previously required only a normal user JWT, so any authenticated wallet could read privileged audit data. This change introduces the shared admin authorization primitive required by vendor governance and other protocol operations.
Problem this solves
Admin status cannot safely be a self-selected user role. The API now derives it exclusively from a startup-validated
ADMIN_WALLETSallowlist, and empty configuration denies all admin access.Changes Made
AdminGuardwith a generic 403 response and wallet-scoped rejection logging.JwtAuthGuardandAdminGuardto the audit controller with full 401/403 Swagger responses.Screenshots
Not applicable; this is an API/security change.
How it was tested
npm run build— zero TypeScript errorsnpm test -- --runInBand— 30 suites, 325 tests passedgit diff --cached --checkAdditional Notes
adminwas not added toUSER_ROLES; wallet-bound roles remain self-selectable and cannot grant administrative access. No admin address is hardcoded.