|
1 | 1 | = Exploit Protection Migrations
|
2 | 2 |
|
| 3 | +The 5.8 migration guide contains several steps for |
| 4 | +ifdef::spring-security-version[] |
| 5 | +xref:5.8.2@migration/servlet/exploits.adoc[exploit protection migrations] when updating to 6.0. |
| 6 | +endif::[] |
| 7 | +ifndef::spring-security-version[] |
| 8 | +exploit protection migrations when updating to 6.0. |
| 9 | +endif::[] |
| 10 | +You are encouraged to follow those steps first. |
| 11 | + |
3 | 12 | The following steps relate to how to finish migrating exploit protection support.
|
4 | 13 |
|
| 14 | +== Defer Loading CsrfToken |
| 15 | + |
| 16 | +In Spring Security 5.8, the default `CsrfTokenRequestHandler` for making the `CsrfToken` available to the application is `CsrfTokenRequestAttributeHandler`. |
| 17 | +The default for the field `csrfRequestAttributeName` is `null`, which causes the CSRF token to be loaded on every request. |
| 18 | + |
| 19 | +In Spring Security 6, `csrfRequestAttributeName` defaults to `_csrf`. |
| 20 | +If you configured the following only for the purpose of updating to 6.0, you can now remove it: |
| 21 | + |
| 22 | + requestHandler.setCsrfRequestAttributeName("_csrf"); |
| 23 | + |
| 24 | +== Protect against CSRF BREACH |
| 25 | + |
| 26 | +In Spring Security 5.8, the default `CsrfTokenRequestHandler` for making the `CsrfToken` available to the application is `CsrfTokenRequestAttributeHandler`. |
| 27 | +`XorCsrfTokenRequestAttributeHandler` was added to allow opting into CSRF BREACH support. |
| 28 | + |
| 29 | +In Spring Security 6, `XorCsrfTokenRequestAttributeHandler` is the default `CsrfTokenRequestHandler` for making the `CsrfToken` available. |
| 30 | +If you configured the `XorCsrfTokenRequestAttributeHandler` only for the purpose of updating to 6.0, you can remove it completely. |
| 31 | + |
| 32 | +[NOTE] |
| 33 | +==== |
| 34 | +If you have set the `csrfRequestAttributeName` to `null` in order to opt out of deferred tokens, or if you have configured a `CsrfTokenRequestHandler` for any other reason, you can leave the configuration in place. |
| 35 | +==== |
| 36 | + |
5 | 37 | == CSRF BREACH with WebSocket support
|
6 | 38 |
|
7 | 39 | In Spring Security 5.8, the default `ChannelInterceptor` for making the `CsrfToken` available with xref:servlet/integrations/websocket.adoc[WebSocket Security] is `CsrfChannelInterceptor`.
|
|
0 commit comments