CSRF token
A secret value tied to the user's session that must accompany each state-changing request, which another website cannot read or guess.
In more detail
The token is usually tied to the user's session and sent in a hidden form field or a custom header. Another site cannot read the token, so it cannot forge a valid request even though the browser sends the cookies.
Example
The course's fixed handler accepts a change only when the cookie matches the session and the token matches the one issued with the form.Related terms
- cross-site request forgery — An attack where another website makes the victim's browser send a request to your site, and the browser's cookie makes it look genuine.
- SameSite — A cookie attribute that limits whether the browser sends the cookie on requests started by other websites.
- session — A record the server keeps about a logged-in caller, found on each request through a handle the client presents, usually in a cookie.
Taught in
- CSRF Mitigations, SameSite Cookies And Subresource Integrity — Frontend Architecture & Web Platform
- Cross-Site Request Forgery — Application Security & Threat Modeling for Engineers