liveBook · Manning

Cross-site request forgery

As explained in Acing the Frontend Interview

Cross-site request forgery is an attack that tricks an authenticated user’s browser into sending an unintended request to a trusted site.

Cross-site request forgery (CSRF) occurs when a malicious third-party site tricks an authenticated user into submitting an unintended request to an application. section 2.4

Protect forms with a server-generated anti-CSRF token in a hidden field. Validate the token on every submission so requests initiated by a malicious site can be rejected. section 2.4

How Acing the Frontend Interview covers it

How deep it goes
Explains the attack and token-based defense but does not provide token-generation or validation code.
Examples
Uses an authenticated user tricked into submitting an unintended action as the attack scenario.
What it assumes
Assumes familiarity with HTML forms and authenticated sessions; does not teach token implementation from zero.
What you can do after
Operate/configure it by adding server-generated hidden anti-CSRF tokens and validating them on every form submission.
How it connects
Places CSRF protection alongside input validation, cross-site scripting prevention, and SQL injection prevention in form security.

Also explained in

Compare how 6 books explain cross-site request forgery →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Acing the Frontend Interview. The section links point to the parts of the book it draws on.