awesome-everything RU
↑ Back to the climb

Security

CSRF: multiple-choice review

Crux Multiple-choice synthesis across the CSRF unit — ambient authority, SameSite gaps, GET side effects, token patterns, Origin checks, and why CORS is not CSRF protection.
Your altitude — climbing toward senior
ZeroJuniorMiddleSenior
You are at senior altitude — in orbit
◷ 13 min

Six questions that cut across the whole unit. Each one mirrors a decision you make reviewing a real auth design — not a definition to recite, but a tradeoff to weigh when an endpoint changes state.

Goal

Confirm you can connect ambient authority, SameSite’s deliberate gaps, the token patterns, and Origin checks — the synthesis the lesson built toward, and the trap of mistaking CORS for a CSRF defense.

Quiz

A reviewer claims 'our session cookie is HttpOnly and Secure, so we're safe from CSRF.' Why is that reasoning wrong?

Quiz

Your session cookies are SameSite=Lax. A hidden form on evil.com auto-submits a cross-site POST /transfer. What happens, and which endpoint is actually still exposed?

Quiz

Why is 'never perform a state change on a GET request' a real security rule and not just REST style preference?

Quiz

A stateless JSON API uses the plain double-submit cookie pattern: a random value in a cookie that must be echoed in a header. An attacker controls a subdomain with an XSS. Why can they bypass it, and what's the fix?

Quiz

A team adds a strict CORS policy (no foreign origins allowed) and concludes their state-changing endpoints are now CSRF-safe. Where does this reasoning fail?

Quiz

An attacker logs the victim's browser into the ATTACKER's account (login CSRF), so the victim's later activity is recorded under the attacker's identity. Which defense addresses this, and why is the usual reasoning incomplete?

Recap

The through-line of the unit is one chain: cookies are ambient authority, so the browser sends your session on any request bound for your origin — including a forged write. SameSite=Lax cut the cross-site POST surface in 2020 but left GET side effects, SameSite=None, and the 120s Lax+POST window, so it is defense-in-depth, not the lock. A real defense layers an unguessable token (synchronizer for stateful apps, HMAC-signed double-submit for stateless APIs), an Origin/Referer check, and the rule that mutations never ride GET. Two traps recur: HttpOnly/Secure and CORS both feel like CSRF defenses but address reading, not the forged write that has already executed.

Continue the climb ↑CSRF: free-recall review
shortcuts expand
search
K
prev piece
k
next piece
j
cycle tier
t
this menu
?
sources3
expand
  1. 01
  2. 02
  3. 03

Trademarks belong to their respective owners. Editorial reference only.