Skip to content

Commit 13d6eb1

Browse files
authored
Merge pull request #213 from righettod/master
Add info about base-uri
2 parents 5744832 + a28ebb8 commit 13d6eb1

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed
Binary file not shown.

β€Žtab_bestpractices.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The following section proposes a configuration for the [actively supported and w
4242
| Strict-Transport-Security | `max-age=31536000; includeSubDomains` |
4343
| X-Frame-Options | `deny` |
4444
| X-Content-Type-Options | `nosniff` |
45-
| Content-Security-Policy | `default-src 'self'; form-action 'self'; object-src 'none'; frame-ancestors 'none'; upgrade-insecure-requests; block-all-mixed-content` |
45+
| Content-Security-Policy | `default-src 'self'; form-action 'self'; base-uri 'self'; object-src 'none'; frame-ancestors 'none'; upgrade-insecure-requests; block-all-mixed-content` |
4646
| X-Permitted-Cross-Domain-Policies | `none` |
4747
| Referrer-Policy | `no-referrer` |
4848
| Clear-Site-Data | `"cache","cookies","storage"` |
@@ -344,22 +344,30 @@ This section describes some points, to keep in mind, during the creation of a [C
344344

345345
🚩 Not every **[directives](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy#directives)** fallback to the **[default-src](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/default-src)** directive when it is not specified in the CSP policy.
346346

347-
## Directive form-action
347+
### Directive form-action
348348

349349
πŸ‘€ It is the case for the **[form-action](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/form-action)** directive. Therefore, an html form can be used to bypass the CSP in place when the `form-action` is not defined.
350350

351351
πŸ“Ί This [demonstration video](assets/misc/demo_csp_bypass_due_to_no_form_action_directive.mp4) show an example.
352352

353353
πŸ’‘ Therefore, ensure to always specify the `form-action` directive in a CSP policy to at least, the `'self'` value, to allow forms only on the current domain.
354354

355-
## Directive frame-ancestors
355+
### Directive frame-ancestors
356356

357357
πŸ‘€ It is the case for the **[frame-ancestors](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors)** directive. Therefore, IF it is not defined **AND** IF the header [X-Frame-Options](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options) is not/incorrectly specified then the current domain can be embedded into a frame.
358358

359359
πŸ“Ί This [demonstration video](assets/misc/demo_csp_bypass_due_to_no_frame_ancestors_directive.mp4) show an example.
360360

361361
πŸ’‘ Therefore, ensure to always specify the `frame-ancestors` directive in a CSP policy to at least, the `'none'` value, to deny the current domain to be "framed".
362362

363+
### Directive base-uri
364+
365+
πŸ‘€ It is the case for the **[base-uri](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/base-uri)** directive.
366+
367+
πŸ“Ί This [demonstration video](assets/misc/demo_csp_bypass_due_to_no_base_uri_directive.mp4) show an example.
368+
369+
πŸ’‘ Therefore, ensure to always specify the `base-uri` directive in a CSP policy to at least, the `'self'` value, to only allow the current domain to be specified as the document's base URI via a `<base href="..." />` html tag.
370+
363371
## Support for a large CSP policy
364372

365373
Tests were performed to identify if any limitation was in place, regarding the definition and usage of a large CSP policy. Tests were performed against the following browsers:

0 commit comments

Comments
Β (0)