summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-07-18 15:33:15 +0200
committerGitHub <noreply@github.com>2019-07-18 15:33:15 +0200
commit057e88e9e77c6f7e75423e4e2f4bc78fa042611a (patch)
treeddb03bf154170ebf1625289c6a576a0fcc2b49b4 /lib/private
parent940a3130b2de0ddf3e45cbc1a71fed45603b23e9 (diff)
parentea935f65fdc94b94b4509a139477b52f046dc03f (diff)
downloadnextcloud-server-057e88e9e77c6f7e75423e4e2f4bc78fa042611a.tar.gz
nextcloud-server-057e88e9e77c6f7e75423e4e2f4bc78fa042611a.zip
Merge pull request #16380 from Dreamsorcerer/patch-1
Allow use of server var for CSP nonce
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php
index 795d8cc8642..f4743369e6e 100644
--- a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php
+++ b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php
@@ -58,7 +58,11 @@ class ContentSecurityPolicyNonceManager {
*/
public function getNonce(): string {
if($this->nonce === '') {
- $this->nonce = base64_encode($this->csrfTokenManager->getToken()->getEncryptedValue());
+ if (empty($this->request->server['CSP_NONCE'])) {
+ $this->nonce = base64_encode($this->csrfTokenManager->getToken()->getEncryptedValue());
+ } else {
+ $this->nonce = $this->request->server['CSP_NONCE'];
+ }
}
return $this->nonce;