liveBook · Manning

CSRF token

A CSRF token is an unpredictable server-issued value required on state-changing requests to verify that they originated from the intended application.

How 2 Manning books explain it

Acing the Frontend Interview

A CSRF token is an unpredictable server-issued value that verifies a state-changing request originated from an authorized application context.

How it is used
Protects HTML form submissions from unintended actions initiated by a malicious third-party site.
How deep it goes
Specifies server generation, hidden fields, and validation on every submission, but does not detail token generation or validation logic.
Examples
Uses the scenario of an attacker tricking an authenticated user into submitting an unintended action.
What you can do after
Practice/perform it by placing a server-generated token in a hidden form field and validating it on every submission.

Read how Acing the Frontend Interview explains CSRF token →

ASP.NET Core in Action, 3e

An antiforgery token is a value paired between a form or request and a browser cookie to verify that a state-changing request originated from the legitimate application.

How it is used
Protects cookie-authenticated state-changing forms and requests from forged submissions made by malicious websites.
How deep it goes
Explains the attack, paired cookie and hidden-field tokens, framework defaults, and an opt-out attribute, but not token-generation internals.
Examples
Uses a banking transfer or withdrawal form with an amount field and a hidden __RequestVerificationToken field.
What you can do after
Apply it via Razor Pages by retaining default antiforgery validation and recognizing when disabling it requires caution.

Read how ASP.NET Core in Action, 3e explains CSRF token →

Also covered in

What to know first

Related concepts

Questions about CSRF token

What is CSRF token?

A CSRF token is an unpredictable server-issued value required on state-changing requests to verify that they originated from the intended application.

Which Manning books explain CSRF token?

Acing the Frontend Interview and ASP.NET Core in Action, 3e.

What should I know before learning CSRF token?

Manning books that teach CSRF token usually introduce cookie first.

What kinds of CSRF token are there?

Kinds of CSRF token include DefaultCsrfToken.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.