Here is my scenario: I have an MVC web application and a web API. The web application calls the web api to save / receive data from the server.
Let's say this is a question / answer website. Right now I have an API that gives me a user ID, if I provide a username, password. But there are other areas on the website, and itβs easy to find a different user ID. I save the user ID in the session store and send it to the POST object where necessary. Now any user can configure this user ID in the session store, and they can send a question / answer on behalf of another user.
How can I prevent this? One of the approaches that I was thinking about, but not sure, is this a possible solution - can we extract the user ID from the submitted token on the server side?
source
share