]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix detection of firefox in ContentSecurityPolicyNonceManager 33069/head
authorCarl Schwan <carl@carlschwan.eu>
Wed, 29 Jun 2022 15:05:48 +0000 (17:05 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Thu, 30 Jun 2022 00:46:47 +0000 (00:46 +0000)
Reuse Request::USER_AGENT_FIREFOX, and also update the safari detection
since safari < 12 is not supported anymore and we can remove a bit of
code duplication

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php

index f332913572707bb07d09cdf92f3e4aaadda33a9e..1167b3358d2ee56ed5d9ee42a2d877083ed8075d 100644 (file)
@@ -80,10 +80,8 @@ class ContentSecurityPolicyNonceManager {
        public function browserSupportsCspV3(): bool {
                $browserWhitelist = [
                        Request::USER_AGENT_CHROME,
-                       // Firefox 45+
-                       '/^Mozilla\/5\.0 \([^)]+\) Gecko\/[0-9.]+ Firefox\/(4[5-9]|[5-9][0-9])\.[0-9.]+$/',
-                       // Safari 12+
-                       '/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\) Version\/(?:1[2-9]|[2-9][0-9])\.[0-9]+(?:\.[0-9]+)? Safari\/[0-9.A-Z]+$/',
+                       Request::USER_AGENT_FIREFOX,
+                       Request::USER_AGENT_SAFARI,
                ];
 
                if ($this->request->isUserAgent($browserWhitelist)) {