Uh oh!
There was an error while loading. Please reload this page.
Fix for ignored CSP_NONCE in ContentSecurity Header - #43573
Conversation
CSP_NONCE in ContentSecurity Header
susnux
left a comment
There was a problem hiding this comment.
Looks good!
But then we can remove csrfTokenManager from the class as it is no longer used.
susnux
commented
Feb 20, 2024
There might be a problem because all our webpack loaded scripts use the csrf token as nonce -> will break if you use a custom nonce. But we should fix that. |
HolgerHees
commented
Jul 30, 2024
@susnux it looks like my change will be merged in version 30.0.0. Is the problem, you mentioned solved? |
Uh oh!
There was an error while loading. Please reload this page.
5cf8647 to
89575c5Compare
For this issue I pushed a commit to provide the CSP nonce as Ref: https://html.spec.whatwg.org/multipage/urls-and-fetching.html#nonce-attributes If we approve this PR then we should go with this: nextcloud-libraries/nextcloud-auth#673 |
Uh oh!
There was an error while loading. Please reload this page.
89575c5 to
0b1d4c9Compare0b1d4c9 to
68d4077CompareWe should use 'cspNonceManager' for requesting the NONCE value, because it is doing the same as before, except that it honors a CPS_NONCE environment variable if available. Signed-off-by: Holger Hees <holger.hees@gmail.com>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
68d4077 to
fbfa4dbCompareSigned-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
fbfa4db to
f1c1cf1CompareThis way we use the CSP nonce for dynamically loaded scripts. Important to notice: The CSP nonce must NOT be injected in `content` as this can lead to value exfiltration using e.g. side-channel attacts (CSS selectors). Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
f1c1cf1 to
2916e5dCompare
We should use 'cspNonceManager' for requesting the NONCE value, because it is doing the same as before, except that it honors a CPS_NONCE environment variable if available.
If a CSP_NONCE env var is defined, it is used nearly everywhere, except for setting the correct ContentSecurityPolicy Header.
This commit fixes this.