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: README.md
+105Lines changed: 105 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,92 @@ If set to `0`, error response caches will be stored indefinitely.
60
60
61
61
See [`craft\helpers\ConfigHelper::durationInSeconds()`](https://docs.craftcms.com/api/v3/craft-helpers-confighelper.html#method-durationinseconds) for a list of supported value types.
62
62
63
+
### csp [array|null]
64
+
*Default `null`*
65
+
66
+
Configure the Content-Security-Policy header set by Toolmate. Some useful tips:
67
+
68
+
* Avoid using `unsafe-inline` and `unsafe-eval` policies, especially for the `script-src` directive. CSP nonces should ideally be used for inline script or style tags, see the `cspNonce()` Twig function.
69
+
* Nonces and `unsafe-inline` cannot be combined. Toolmate works around this to avoid CSP errors, but TLDR; is that you don't need to set nonces if you're also using `unsafe-inline`.
70
+
* CSP nonces generated by `cspNonce()` are safe to put inside `{% cache %}` tags
71
+
* To enable data-URLs, add a `data:` policy to the relevant directives
72
+
* For CP requests, Toolmate will always add the necessary `unsafe-inline` and `unsafe-eval` policies, because the CP isn't possible to use without.
73
+
74
+
#### csp[enabled][bool]
75
+
*Default `false`*
76
+
77
+
If set to `false`, the CSP header will not be sent for any requests.
78
+
79
+
#### csp[enabledForCp][bool]
80
+
*Default `false`*
81
+
82
+
If set to `false`, the CSP header will only be sent for site requests.
83
+
84
+
#### csp[reportOnly][bool]
85
+
*Default `false`*
86
+
87
+
If set to `true`, the CSP header will be sent, but not enforced (i.e. dry-run mode). Useful for testing policies.
88
+
89
+
#### csp[directives][array]
90
+
91
+
See https://content-security-policy.com/, and the example config below.
0 commit comments