Did the User Mean to Send This Request?
Compare a normal administrator action with changed browser requests, keeping cookie delivery, permission, and user intent separate.
You’re reading a preview. Premium includes the full lesson and specialist practice. View the full curriculum.
A real administrator, an unwanted change
An administrator is signed in to a team app. The app lets them change a member's role. A different page causes their browser to send the same kind of request. The server sees a genuine administrator session—but that alone does not prove the administrator chose the change.
This is the question behind CSRF: did the user intend this state-changing request? We will keep that question separate from whether the user is signed in and allowed to manage roles.
Begin with the request that should work
The administrator opens the trusted app and submits a POST with a valid session and the framework's CSRF token. That legitimate operation should still work after the fix.
The original handler checks the administrator role, accepts JSON bytes even when the media type is text/plain, and has a legacy GET route reaching the same change. It has no CSRF check.