Fix: Missing ownership check on PUT /api/Addresss/:id allows modifying other users' saved addresses - #366
Closed
WesternConcrete wants to merge 2 commits into
Closed
Fix: Missing ownership check on PUT /api/Addresss/:id allows modifying other users' saved addresses#366WesternConcrete wants to merge 2 commits into
WesternConcrete wants to merge 2 commits into
Conversation
Signed-off-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Wes Convery <2wconvery@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Signed-off-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-Authored-By: Wes Convery <2wconvery@gmail.com>
3 tasks
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.
Description
Finding: Missing ownership check on PUT /api/Addresss/:id allows modifying other users' saved addresses
Repo: COG-GTM/juice-shop
Fix: Route
PUT /api/Addresss/:idto a new owner-scopedupdateAddressById()handler inroutes/address.tsinstead of falling through to the generic finale-rest resource.GET and DELETE
/api/Addresss/:idalready use handlers that querywhere: { id, UserId }, but PUT only ransecurity.appendUserId()and then let finale-rest update the row byidalone, so any authenticated user could overwrite another customer's delivery address. The new handler:Only fields present in the body are written, so partial updates behave as before. Test added in
test/api/address.test.ts: another user's PUT returns 400 and the address is unchanged.eslint and
tsc --noEmitpass locally; the API test suite could not be run locally becausefrontend/distis not built in this environment — relying on CI fortest/api.Resolved or fixed issue: none
AI Tool Disclosure
DevinDevin (Cognition)Daily security sweep: substantiate and fix new vulnerabilities in COG-GTM/juice-shopAffirmation
Link to Devin session: https://app.devin.ai/sessions/a749d64c0c0e49149bdaff3d2605b5c2
Open in Devin Desktop: https://app.devin.ai/desktop/session/a749d64c0c0e49149bdaff3d2605b5c2?variant=devin
Requested by: @WesternConcrete