Get Rides Scoping Security Issue#680
Open
eicyer wants to merge 3 commits into
Open
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for carriage-web ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
anika-4444
requested changes
Mar 22, 2026
anika-4444
left a comment
Contributor
There was a problem hiding this comment.
Overall looks good to me, just some slight changes needed with shared types
| import { notify } from '../util/notification'; | ||
| import { Change } from '@carriage-web/shared/types'; | ||
| import { Change, JWTPayload } from '../util/types'; | ||
| import { UserType } from '../models/subscription'; |
Contributor
There was a problem hiding this comment.
Because of Ben's PR to change all types to the shared types folder, I think you might have to change the imports slightly here. change, payload and usertype stuff should be coming from '../../../shared/build/types'
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.
Summary
This PR attempts to solve the security issue where a driver or rider could acce4ss all riders and rides. The cause of this issue was that our GET/rides function was validating if the calling user was any driver or rider. The fix is extracting the user's id from the JWT token and if the user is a driver or rider filtering the rides that belong to the particular user calling the function. If the user is an admin the behaviour is unchanged.
Test Plan
I added rides.tests file to check the possible execution paths. Another possible test is attempting an attack given the updated code.
Notes
In rider.test and driver.test the test cases aren't updated to reflect drivers' availabilty field change. The test cases should be updated to test the string list availability field.
Also "should reject creating admin with duplicate NetID (same table)" in netid-validation.tests fail due to a seperate reason. That should be handled in a seperate PR.
GET /api/rides/repeating has the same vulnerability and we should patch it when we implement repeating rides feature