Skip to content

Commit 4222537

Browse files
committed
Merge branch '6.0.x' into 6.1.x
Closes gh-14114
2 parents f295e9d + 18c5f43 commit 4222537

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

docs/modules/ROOT/pages/features/exploits/csrf.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ Spring provides two mechanisms to protect against CSRF attacks:
9797

9898
[NOTE]
9999
====
100-
Both protections require that <<csrf-protection-idempotent,Safe Methods be Idempotent>>.
100+
Both protections require that <<csrf-protection-read-only,Safe Methods be Read-only>>.
101101
====
102102

103-
[[csrf-protection-idempotent]]
104-
=== Safe Methods Must be Idempotent
103+
[[csrf-protection-read-only]]
104+
=== Safe Methods Must be Read-only
105105

106-
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+
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].
107107
This means that requests with the HTTP `GET`, `HEAD`, `OPTIONS`, and `TRACE` methods should not change the state of the application.
108108

109109
[[csrf-protection-stp]]
@@ -119,7 +119,7 @@ For example, requiring the actual CSRF token in an HTTP parameter or an HTTP hea
119119
Requiring the actual CSRF token in a cookie does not work because cookies are automatically included in the HTTP request by the browser.
120120

121121
We can relax the expectations to require only the actual CSRF token for each HTTP request that updates the 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>>.
123123
This improves usability, since we want to allow linking to our website from external sites.
124124
Additionally, we do not want to include the random token in HTTP GET, as this can cause the tokens to be leaked.
125125

@@ -190,7 +190,7 @@ Valid values for the `SameSite` attribute are:
190190

191191
* `Strict`: When specified, any request coming from the https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-2.1[same-site] includes the cookie.
192192
Otherwise, the cookie is not included in the HTTP request.
193-
* `Lax`: When specified, cookies are 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 are 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>>.
194194
Otherwise, the cookie is not included in the HTTP request.
195195

196196
Consider how <<csrf-explained,our example>> could be protected using the `SameSite` attribute.

docs/modules/ROOT/pages/reactive/exploits/csrf.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ This section discusses Spring Security's xref:features/exploits/csrf.adoc#csrf[C
77
== Using Spring Security CSRF Protection
88
The steps to using Spring Security's CSRF protection are outlined below:
99

10-
* <<webflux-csrf-idempotent,Use proper HTTP verbs>>
10+
* <<webflux-csrf-read-only,Use proper HTTP verbs>>
1111
* <<webflux-csrf-configure,Configure CSRF Protection>>
1212
* <<webflux-csrf-include,Include the CSRF Token>>
1313

14-
[[webflux-csrf-idempotent]]
14+
[[webflux-csrf-read-only]]
1515
=== Use Proper HTTP Verbs
1616
The first step to protecting against CSRF attacks is to ensure your website uses proper HTTP verbs.
17-
This is covered in detail in xref:features/exploits/csrf.adoc#csrf-protection-idempotent[Safe Methods Must be Idempotent].
17+
This is covered in detail in xref:features/exploits/csrf.adoc#csrf-protection-read-only[Safe Methods Must be Read-only].
1818

1919
[[webflux-csrf-configure]]
2020
=== Configure CSRF Protection

docs/modules/ROOT/pages/servlet/exploits/csrf.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
In an application where end users can xref:servlet/authentication/index.adoc[log in], it is important to consider how to protect against xref:features/exploits/csrf.adoc#csrf[Cross Site Request Forgery (CSRF)].
66

7-
Spring Security protects against CSRF attacks by default for xref:features/exploits/csrf.adoc#csrf-protection-idempotent[unsafe HTTP methods], such as a POST request, so no additional code is necessary.
7+
Spring Security protects against CSRF attacks by default for xref:features/exploits/csrf.adoc#csrf-protection-read-only[unsafe HTTP methods], such as a POST request, so no additional code is necessary.
88
You can specify the default configuration explicitly using the following:
99

1010
[[csrf-configuration]]
@@ -592,7 +592,7 @@ By default, Spring Security defers loading of the `CsrfToken` until it is needed
592592

593593
[NOTE]
594594
====
595-
The `CsrfToken` is needed whenever a request is made with an xref:features/exploits/csrf.adoc#csrf-protection-idempotent[unsafe HTTP method], such as a POST.
595+
The `CsrfToken` is needed whenever a request is made with an xref:features/exploits/csrf.adoc#csrf-protection-read-only[unsafe HTTP method], such as a POST.
596596
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.
597597
====
598598

0 commit comments

Comments
 (0)