Skip to content

Get Rides Scoping Security Issue#680

Open
eicyer wants to merge 3 commits into
masterfrom
jwt-key-fix
Open

Get Rides Scoping Security Issue#680
eicyer wants to merge 3 commits into
masterfrom
jwt-key-fix

Conversation

@eicyer

@eicyer eicyer commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

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

@eicyer eicyer requested a review from a team as a code owner March 11, 2026 21:17
@vercel

vercel Bot commented Mar 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cu-carriage Error Error Mar 25, 2026 10:11pm

@netlify

netlify Bot commented Mar 11, 2026

Copy link
Copy Markdown

Deploy Preview for carriage-web ready!

Name Link
🔨 Latest commit 5cceb86
🔍 Latest deploy log https://app.netlify.com/projects/carriage-web/deploys/69c45d989d93710008a0c660
😎 Deploy Preview https://deploy-preview-680--carriage-web.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@anika-4444 anika-4444 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me, just some slight changes needed with shared types

Comment thread server/src/router/ride.ts Outdated
import { notify } from '../util/notification';
import { Change } from '@carriage-web/shared/types';
import { Change, JWTPayload } from '../util/types';
import { UserType } from '../models/subscription';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Comment thread server/src/router/ride.ts Outdated
Comment thread server/tests/ride.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants