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
@@ -245,7 +233,6 @@ However, you must be very careful, as there are CSRF exploits that can impact JS
245
233
For example, a malicious user can create a http://blog.opensecurityresearch.com/2012/02/json-csrf-with-parameter-padding.html[CSRF with JSON by using the following form]:
@@ -254,13 +241,11 @@ For example, a malicious user can create a http://blog.opensecurityresearch.com/
254
241
value="Win Money!"/>
255
242
</form>
256
243
----
257
-
====
258
244
259
245
260
246
This produces the following JSON structure
261
247
262
248
.CSRF with JSON request
263
-
====
264
249
[source,javascript]
265
250
----
266
251
{ "amount": 100,
@@ -269,13 +254,11 @@ This produces the following JSON structure
269
254
"ignore_me": "=test"
270
255
}
271
256
----
272
-
====
273
257
274
258
If an application were not validating the `Content-Type` header, it would be exposed to this exploit.
275
259
Depending on the setup, a Spring MVC application that validates the Content-Type could still be exploited by updating the URL suffix to end with `.json`, as follows:
The optional `includeSubDomains` directive instructs the browser that subdomains (such as `secure.mybank.example.com`) should also be treated as an HSTS domain.
151
143
@@ -193,12 +185,10 @@ While not perfect, the frame breaking code is the best you can do for the legacy
193
185
A more modern approach to address clickjacking is to use https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options[X-Frame-Options] header.
194
186
By default, Spring Security disables rendering pages within an iframe by using with the following header:
195
187
196
-
====
197
188
[source]
198
189
----
199
190
X-Frame-Options: DENY
200
191
----
201
-
====
202
192
203
193
[[headers-xss-protection]]
204
194
== X-XSS-Protection
@@ -213,12 +203,10 @@ The filter has been deprecated in major browsers, and https://cheatsheetseries.o
213
203
214
204
By default, Spring Security blocks the content by using the following header:
215
205
216
-
====
217
206
[source]
218
207
----
219
208
X-XSS-Protection: 0
220
209
----
221
-
====
222
210
223
211
224
212
[[headers-csp]]
@@ -250,25 +238,21 @@ A security policy contains a set of security policy directives, each responsible
250
238
For example, a web application can declare that it expects to load scripts from specific, trusted sources by including the following header in the response:
An attempt to load a script from another source other than what is declared in the `script-src` directive is blocked by the user-agent.
261
247
Additionally, if the https://www.w3.org/TR/CSP2/#directive-report-uri[report-uri] directive is declared in the security policy, the violation will be reported by the user-agent to the declared URL.
262
248
263
249
For example, if a web application violates the declared security policy, the following response header instructs the user-agent to send violation reports to the URL specified in the policy's `report-uri` directive.
https://www.w3.org/TR/CSP2/#violation-reports[Violation reports] are standard JSON structures that can be captured either by the web application's own API or by a publicly hosted CSP violation reporting service, such as https://report-uri.io/.
274
258
@@ -279,12 +263,10 @@ When a policy is deemed effective, it can be enforced by using the `Content-Secu
279
263
Given the following response header, the policy declares that scripts can be loaded from one of two possible sources.
If the site violates this policy, by attempting to load a script from `evil.example.com`, the user-agent sends a violation report to the declared URL specified by the `report-uri` directive but still lets the violating resource load.
290
272
@@ -311,12 +293,10 @@ page the user was on.
311
293
Spring Security's approach is to use the https://www.w3.org/TR/referrer-policy/[Referrer Policy] header, which provides different https://www.w3.org/TR/referrer-policy/#referrer-policies[policies]:
312
294
313
295
.Referrer Policy Example
314
-
====
315
296
[source]
316
297
----
317
298
Referrer-Policy: same-origin
318
299
----
319
-
====
320
300
321
301
The Referrer-Policy response header instructs the browser to let the destination knows the source where the user was previously.
322
302
@@ -331,12 +311,10 @@ See the relevant sections to see how to configure both xref:servlet/exploits/hea
331
311
https://wicg.github.io/feature-policy/[Feature Policy] is a mechanism that lets web developers to selectively enable, disable, and modify the behavior of certain APIs and web features in the browser.
332
312
333
313
.Feature Policy Example
334
-
====
335
314
[source]
336
315
----
337
316
Feature-Policy: geolocation 'self'
338
317
----
339
-
====
340
318
341
319
With Feature Policy, developers can opt-in to a set of "`policies`" for the browser to enforce on specific features used throughout your site.
342
320
These policies restrict what APIs the site can access or modify the browser's default behavior for certain features.
@@ -353,12 +331,10 @@ See the relevant sections to see how to configure both xref:servlet/exploits/hea
353
331
https://w3c.github.io/webappsec-permissions-policy/[Permissions Policy] is a mechanism that lets web developers selectively enable, disable, and modify the behavior of certain APIs and web features in the browser.
354
332
355
333
.Permissions Policy Example
356
-
====
357
334
[source]
358
335
----
359
336
Permissions-Policy: geolocation=(self)
360
337
----
361
-
====
362
338
363
339
With Permissions Policy, developers can opt-in to a set of "policies" for the browser to enforce on specific features used throughout your site.
364
340
These policies restrict what APIs the site can access or modify the browser's default behavior for certain features.
@@ -374,12 +350,10 @@ See the relevant sections to see how to configure both xref:servlet/exploits/hea
374
350
375
351
https://www.w3.org/TR/clear-site-data/[Clear Site Data] is a mechanism by which any browser-side data (cookies, local storage, and the like) can be removed when an HTTP response contains this header:
0 commit comments