Lab exercise: an order API returns any customer’s order when the ID is changed
What we found
The order endpoint checks that the user is signed in, but not that the order belongs to them. Changing the order ID in the request returns another customer’s name, address and items. Developers find and exploit the flaw before they write the fix.
Impact
Any signed-in user can read every customer’s orders.
How to fix it
Check ownership on the server for every object request, using the authenticated user’s identity rather than IDs sent by the client, and add an automated test that fails if the check is removed.





