advancedCSRF: Cross-Site Request Forgery

Why doesn't Spring Security's default CSRF protection cover GET requests?

HTTP semantics define GET as a safe, idempotent method that should not have side effects — CSRF protection targets state-changing operations (POST/PUT/DELETE/PATCH). If an application incorrectly implements a destructive operation behind a GET request, that design itself is the vulnerability (also making it trivially exploitable via a simple <img src=...> tag, no form needed), and no amount of CSRF token configuration fixes a fundamentally unsafe use of GET.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What is an AuthorizationDeniedEvent, and how is it different from an authentication failure event?← Back to all Spring Security questions