fix(api): restrict admin metrics to admin role - #10992
Open
es3298 wants to merge 1 commit into
Open
Conversation
This was referenced Jul 7, 2026
Author
|
@claim-reviewer this refreshed es3298 PR is open, mergeable, and the update-leaderboard workflow passed on the opened PR. It closes creator-owned issue #10905 under parent bounty #743 with focused admin-route coverage and a demo video. If accepted for reward, please confirm whether payout is automatic or where @es3298 should provide payout details privately. |
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.
/claim #743
/claim #10905
Fixes #10905
Summary
adminMiddlewareto requirereq.user.role === adminafter JWT authentication./api/adminroutes.Why
/api/admin/metricspreviously accepted any valid JWT, so non-admin users could read admin metrics. The route now preserves 401 for missing/invalid tokens and returns 403 for authenticated non-admin users.Demo
https://raw.githubusercontent.com/es3298/bug-bounty/es3298/admin-role-claim-refresh/docs/demo/admin-role-hardening-10905.mp4
Validation
node --test apps/api/src/tests/adminRoutes.test.jsnpm test --workspace apps/apigit diff --check origin/main...HEADClaim notes
This is a refreshed es3298 submission for the creator-owned scoped issue #10905 under parent bounty #743. The previous PR #10906 had the same focused fix but did not receive the
update-leaderboardopened-event workflow, so this PR is opened from currentorigin/mainto enter the normal claim automation path. No payout, credential, wallet, or off-platform payment details are included publicly.