Problem
The frontend's rate-limit dashboard sends Authorization: Bearer <admin token> to /api/admin/analytics/rate-limit-hits, /api/admin/analytics/top-users, /api/admin/analytics/violation-heatmap, and /api/admin/analytics/upgrade-recommendations. The indexer has admin/, auth/, and rateLimit/ modules, but there is no documentation of how the admin token is issued, what it authorises, whether it expires, or how it is rotated.
Admin analytics expose usage and user data, so the auth model for these routes needs to be explicit and verified rather than implied by client code.
What needs to be done
- Document the admin auth scheme: how the token is configured/issued, its scope, expiry, and rotation.
- Verify every
/api/admin/* route enforces the check (no route should be reachable unauthenticated).
- Return a clear
401 for missing/invalid tokens and 403 where appropriate, so the client can react correctly.
- Ensure tokens are never logged.
- Add tests covering unauthenticated and invalid-token access for each admin route.
Files
indexer/src/admin/, indexer/src/auth/
README.md / docs/
Acceptance deliverables
- Documented admin auth scheme.
- Every admin route rejects unauthenticated and invalid-token requests with the correct status.
Tests to pass
- Tests asserting
401 for missing and invalid tokens on each /api/admin/* route.
- A test asserting a valid token succeeds.
Problem
The frontend's rate-limit dashboard sends
Authorization: Bearer <admin token>to/api/admin/analytics/rate-limit-hits,/api/admin/analytics/top-users,/api/admin/analytics/violation-heatmap, and/api/admin/analytics/upgrade-recommendations. The indexer hasadmin/,auth/, andrateLimit/modules, but there is no documentation of how the admin token is issued, what it authorises, whether it expires, or how it is rotated.Admin analytics expose usage and user data, so the auth model for these routes needs to be explicit and verified rather than implied by client code.
What needs to be done
/api/admin/*route enforces the check (no route should be reachable unauthenticated).401for missing/invalid tokens and403where appropriate, so the client can react correctly.Files
indexer/src/admin/,indexer/src/auth/README.md/docs/Acceptance deliverables
Tests to pass
401for missing and invalid tokens on each/api/admin/*route.