You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/features/exploits/csrf.adoc
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -97,13 +97,13 @@ Spring provides two mechanisms to protect against CSRF attacks:
97
97
98
98
[NOTE]
99
99
====
100
-
Both protections require that <<Safe Methods Must be Idempotent>>
100
+
Both protections require that <<Safe Methods Must be Read-only>>
101
101
====
102
102
103
-
[[csrf-protection-idempotent]]
104
-
=== Safe Methods Must be Idempotent
103
+
[[csrf-protection-read-only]]
104
+
=== Safe Methods Must be Read-only
105
105
106
-
In order for <<csrf-protection,either protection>> against CSRF to work, the application must ensure that https://tools.ietf.org/html/rfc7231#section-4.2.1["safe" HTTP methods are idempotent].
106
+
In order for <<csrf-protection,either protection>> against CSRF to work, the application must ensure that https://tools.ietf.org/html/rfc7231#section-4.2.1["safe" HTTP methods are read-only].
107
107
This means that requests with the HTTP method `GET`, `HEAD`, `OPTIONS`, and `TRACE` should not change the state of the application.
108
108
109
109
[[csrf-protection-stp]]
@@ -119,7 +119,7 @@ For example, requiring the actual CSRF token in an HTTP parameter or an HTTP hea
119
119
Requiring the actual CSRF token in a cookie does not work because cookies are automatically included in the HTTP request by the browser.
120
120
121
121
We can relax the expectations to only require the actual CSRF token for each HTTP request that updates state of the application.
122
-
For that to work, our application must ensure that <<csrf-protection-idempotent,safe HTTP methods are idempotent>>.
122
+
For that to work, our application must ensure that <<csrf-protection-read-only,safe HTTP methods are read-only>>.
123
123
This improves usability since we want to allow linking to our website using links from external sites.
124
124
Additionally, we do not want to include the random token in HTTP GET as this can cause the tokens to be leaked.
125
125
@@ -190,7 +190,7 @@ Valid values for the `SameSite` attribute are:
190
190
191
191
* `Strict` - when specified any request coming from the https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-2.1[same-site] will include the cookie.
192
192
Otherwise, the cookie will not be included in the HTTP request.
193
-
* `Lax` - when specified cookies will be sent when coming from the https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-2.1[same-site] or when the request comes from top-level navigations and the <<Safe Methods Must be Idempotent,method is idempotent>>.
193
+
* `Lax` - when specified cookies will be sent when coming from the https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-2.1[same-site] or when the request comes from top-level navigations and the <<Safe Methods Must be Read-only,method is read-only>>.
194
194
Otherwise, the cookie will not be included in the HTTP request.
195
195
196
196
Let's take a look at how <<csrf-explained,our example>> could be protected using the `SameSite` attribute.
Copy file name to clipboardExpand all lines: docs/modules/ROOT/pages/migration/servlet/exploits.adoc
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ In Spring Security 6, the default is that the lookup of the `CsrfToken` will be
17
17
[NOTE]
18
18
====
19
19
The `CsrfToken` is needed whenever a request is made with an HTTP verb that would change the state of the application.
20
-
This is covered in detail in xref:features/exploits/csrf.adoc#csrf-protection-idempotent[Safe Methods Must be Idempotent].
20
+
This is covered in detail in xref:features/exploits/csrf.adoc#csrf-protection-read-only[Safe Methods Must be Read-only].
21
21
Additionally, it is needed by any request that renders the token to the response, such as a web page with a `<form>` tag that includes a hidden `<input>` for the CSRF token.
0 commit comments