Fix IDOR in link management endpoints#975
Conversation
Three link management endpoints accept user-supplied link IDs
without verifying ownership, allowing any authenticated user to
modify other users' links:
- POST /studio/edit-link (saveLink): add ownership check before update
- POST /studio/sort-link (sortLinks): add user_id where clause
- GET /clearIcon/{id}: add existing link-id middleware to route
|
@lastsamurai26 needs testing. |
|
I went ahead and made the changes, but I'm getting a 500 error in the console. I'm not sure if that's supposed to happen. @JulianPrieber , could you take another look and test it yourself if possible? So we should definitely implement this. |
|
I'm most likely busy until somewhere next week. This should be compatible with the beta build, we can try to merge it there to test. This should have been addressed already in a release two years ago. We got this from upstream but we're the only maintainers of it now. Maybe just try to reproduce it on the latest release build. Or we just yolo it idk |
|
I'm now using the beta(4.9.0) version in a production environment as well. I'd need to install a release version again and test it there, but it doesn't seem to work with the current beta—maybe that's why. Perhaps the TS (@az10b ) should test this with the beta to see if it works there too?
But the fix works |

Summary
Three link management endpoints accept user-supplied link IDs without verifying the authenticated user owns the targeted link, allowing any registered user to modify other users' links.
POST /studio/edit-link(saveLink): Added ownership check — aborts 403 if link belongs to another userPOST /studio/sort-link(sortLinks): Addeduser_idwhere clause so updates only affect the authenticated user's linksGET /clearIcon/{id}: Added existinglink-idmiddleware to the routeSteps to reproduce
/studio/edit-linkwith user B's link ID:Test plan
saveLinkreturns 403 when targeting another user's linksortLinkssilently ignores link IDs not owned by the userclearIconreturns 403 vialink-idmiddleware