MobilityData / mobility-feed-api

Apache License 2.0
8 stars 3 forks source link

Improve access restriction to metrics endpoint #730

Open cka-y opened 3 weeks ago

cka-y commented 3 weeks ago

To ensure only authorized users can access the metrics endpoint, we need to leverage the existing ProtectedRoutes.tsx component. This may require refactoring to restrict access exclusively to users logged in with a mobilitydata.org account.

Tasks:

  1. Review the current implementation of ProtectedRoutes.tsx to assess if any modifications are needed to handle this specific case.
  2. Update or refactor ProtectedRoutes.tsx to block access to the metrics endpoint for users who are either:
    • Not logged in.
    • Logged in with an account that is not under the mobilitydata.org domain.
  3. Test to ensure unauthorized users cannot access the metrics endpoint and confirm that authorized users (with valid mobilitydata.org accounts) retain full access.

Outcome: The metrics endpoint should only be accessible to logged-in users with a mobilitydata.org account, with proper access controls enforced through ProtectedRoutes.tsx.