Skip to content

Commit c332249

Browse files
committed
mention downsides of nonces in CSP
1 parent 82a0087 commit c332249

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

_docs-v6/intro/content-security-policy.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,17 @@ FullCalendar's icon-font is embedded into its CSS with a `data:` protcol. You mu
1818

1919
## Dynamically-Generated Styles
2020

21-
FullCalendar injects its own `<style>` tags onto the page. Your CSP might prohibit this. The solution is to use a [nonce value](https://content-security-policy.com/nonce/).
21+
FullCalendar injects its own `<style>` tags onto the page. Your CSP might prohibit this. A workaround is to use a [nonce value](https://content-security-policy.com/nonce/).
2222

2323
On your server, generate a random nonce value (`abc123` in this example). Then, register it with your CSP. The following line achieves this while also whitelisting the icon-font mentioned above:
2424

2525
```html
26-
<meta http-equiv='Content-Security-Policy' content="default-src 'nonce-abc123'; font-src data:">
26+
<meta http-equiv='Content-Security-Policy' content="default-src …; style-src 'nonce-abc123'; font-src data:">
2727
```
2828

29-
Then, when writing your application's `<script>` and `<link>` tags, include the `nonce` attribute:
30-
3129
```html
32-
<script src='fullcalendar/dist/index.js' nonce='abc123'></script>
33-
<script src='app/index.js' nonce='abc123'></script>
30+
<script src='fullcalendar/dist/index.js'></script>
31+
<script src='app/index.js'></script>
3432
```
3533

3634
Starting with **v6.1.0**, FullCalendar is able to output nonce values.
@@ -43,4 +41,4 @@ You may override this behavior by including a meta at the head of your page. It
4341
<meta name='csp-nonce' content='qwerty456' />
4442
```
4543

46-
For nonce values to be secure, they must be randomly generated on the server and only used once. Consult documentation elsewhere on the web for best practices.
44+
For nonce values to be secure, they must be randomly generated on the server and only used once. Also note that nonces can allow attackers to bypass all other restrictions from the CSP. Consult documentation elsewhere on the web for best practices, e.g. [in the specification](https://www.w3.org/TR/CSP3/#security-considerations).

0 commit comments

Comments
 (0)