Skip to content

protect admin endpoints with wallet allowlist#104

Open
Obiajulu-gif wants to merge 2 commits into
StepFi-app:mainfrom
Obiajulu-gif:codex/issue-97-admin-allowlist
Open

protect admin endpoints with wallet allowlist#104
Obiajulu-gif wants to merge 2 commits into
StepFi-app:mainfrom
Obiajulu-gif:codex/issue-97-admin-allowlist

Conversation

@Obiajulu-gif

Copy link
Copy Markdown

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_WALLETS allowlist, and empty configuration denies all admin access.


Changes Made

  • Added AdminGuard with a generic 403 response and wallet-scoped rejection logging.
  • Added startup validation for comma-separated Stellar public keys and documented fail-closed behavior.
  • Applied JwtAuthGuard and AdminGuard to the audit controller with full 401/403 Swagger responses.
  • Audited all controllers; no other controller currently exposes an admin-assuming route.
  • Added guard and environment validation tests and updated the progress tracker.

Screenshots

Not applicable; this is an API/security change.


How it was tested

  • npm run build — zero TypeScript errors
  • npm test -- --runInBand — 30 suites, 325 tests passed
  • Focused guard/config/JWT tests — 14 tests passed
  • ESLint on every changed TypeScript file
  • git diff --cached --check

Additional Notes

admin was not added to USER_ROLES; wallet-bound roles remain self-selectable and cannot grant administrative access. No admin address is hardcoded.

@Obiajulu-gif
Obiajulu-gif marked this pull request as ready for review July 22, 2026 15:17
@Obiajulu-gif
Obiajulu-gif requested a review from EmeditWeb as a code owner July 22, 2026 15:17
@Obiajulu-gif Obiajulu-gif changed the title [codex] protect admin endpoints with wallet allowlist protect admin endpoints with wallet allowlist Jul 22, 2026
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.

security: protect admin endpoints with an admin allowlist guard

1 participant