Skip to content

Document and verify authentication for the indexer admin analytics endpoints #22

Description

@priscaenoch

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.

Metadata

Metadata

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26documentationImprovements or additions to documentationenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions