CS Fundamentals Trainer · JavaScript · Security
Which of these help protect a cookie-authenticated app against CSRF?
- Using POST instead of GET for the state-changing endpoint
- Setting the session cookie to `SameSite=Lax` or `SameSite=Strict`
- Sending `Access-Control-Allow-Origin` only for your own front-end origin
- Requiring a per-session CSRF token that the server checks on each state-changing request
- Rejecting state-changing requests whose `Origin` header is not your own
Difficulty: medium