I’m developing a web application (SPA using react) that has two views: User and Admin. I don’t want the Admin view to be seen if the user is not an Admin but an attacker can see the view by using a Server’s Response Manipulation attack. Currently, the app’s workflow goes as follow:
- Client authenticates.
- Authentication server stores session cookie on client when authentication is successful.
- Frontend makes a request to the backend so it can get the user’s information, including the role.
- Based on the received response render User or Admin view.
An attacker can intercept the server’s response during step 3 and 4 and change the role to Admin, thus making the FE render the Admin View. Maybe I not supposed to pass the role on the server’s response but I’m not sure what mechanisms exist for enabling this.
Also, note that the attacker can’t see/do anything on the Admin data because the server verifies the user role using the supplied session, so technically speaking the server and the data are secure.
The expectations are:
- The frontend should be able to securely get the user’s role.
- The client shouldn’t be able to change its role on any form.