fix: allow authenticated users to access /users/status route#2608
Open
AnujChhikara wants to merge 2 commits into
Open
fix: allow authenticated users to access /users/status route#2608AnujChhikara wants to merge 2 commits into
AnujChhikara wants to merge 2 commits into
Conversation
Removes the super_user role restriction from the GET /users/status route so any authenticated user can access it, using the standard authenticate middleware instead of authorizeRoles([SUPERUSER]). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
WalkthroughThe user status GET route now requires authentication and query validation, but no longer restricts access to SUPERUSER users. ChangesUser status access control
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Switch the GET /users/status integration tests from the super_user token back to a normal user token, matching the reverted route which now only requires authentication. The unauthorized (401) test is retained. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
prakashchoudhary07
requested changes
Jul 24, 2026
| // TODO: Have a discussion, if this 'users/status' needs to be open or protected. | ||
| // For now making it protected and super_user only to sort the high firestore read issues, for usersStatus collection | ||
| router.get("/", authenticate, authorizeRoles([SUPERUSER]), validateGetQueryParams, getUserStatusControllers); | ||
| router.get("/", authenticate, validateGetQueryParams, getUserStatusControllers); |
Contributor
There was a problem hiding this comment.
Is this used in by any of the other services, where we might have to look into it?
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.
Date: 22 Jul , 2026
Developer Name: @AnujChhikara
Issue Ticket Number
Tech Doc Link
Business Doc Link
Description
PR #2599 temporarily restricted
GET /users/statusto super users (authorizeRoles([SUPERUSER])) to mitigate high Firestore reads on theusersStatuscollection, leaving a TODO to revisit whether the route should stay protected.Since then, we have added pagination to this route and done the query optimization for it (active-users-first, paginated, batched reads), which addressed the high Firestore read concern that motivated the restriction. Because that optimization is now in place, the super_user restriction is no longer needed, so this PR reverts
GET /users/statusto a normally authenticated route.routes/userStatus.js:GET /now runsauthenticate->validateGetQueryParams->getUserStatusControllers(droppedauthorizeRoles([SUPERUSER])), and removed the obsolete super_user TODO comment.test/integration/userStatus.test.js: switched theGET /users/statustests from the super_user token back to a normal user token so they assert a regular authenticated user can access the route. The unauthorized (401) test is retained.Note: the super_user restriction on
/users/search(also added in #2599) is intentionally left unchanged; this PR scopes only to/users/status.Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
Screenshot 1
Test Coverage
Screenshot 1
Additional Notes