= Exploit Protection Migrations The following steps relate to changes around how to configure CSRF. == Defer Loading CsrfToken In Spring Security 5, the default behavior is that the `CsrfToken` will be loaded on every request. This means that in a typical setup, the `HttpSession` must be read for every request even if it is unnecessary. [NOTE] ==== Some examples of where it should be unnecessary to read the session include endpoints marked `permitAll()` such as static assets, static HTML pages, single-page applications hosted under the same domain/server, etc. ==== In Spring Security 6, the default is that the lookup of the `CsrfToken` will be deferred until it is needed. [NOTE] ==== The `CsrfToken` is needed whenever a request is made with an HTTP verb that would change the state of the application. This is covered in detail in xref:features/exploits/csrf.adoc#csrf-protection-idempotent[Safe Methods Must be Idempotent]. Additionally, it is needed by any request that renders the token to the response, such as a web page with a `