Explorar o código

HUE-4455 [security] secure_content_security_policy breaks the editor and GA

Prakash Ranade %!s(int64=9) %!d(string=hai) anos
pai
achega
2af74a7

+ 1 - 1
desktop/conf.dist/hue.ini

@@ -91,7 +91,7 @@
   ## secure_browser_xss_filter=true
 
   # X-Content-Type-Options: nosniff This is a HTTP response header feature that helps prevent attacks based on MIME-type confusion.
-  ## secure_content_security_policy="img-src 'self' www.google-analytics.com; connect-src 'self'; child-src 'none'; object-src 'none'"
+  ## secure_content_security_policy="script-src 'self' 'unsafe-inline' 'unsafe-eval' *.google-analytics.com *.doubleclick.net *.mathjax.org data:;img-src 'self' *.google-analytics.com *.doubleclick.net data:;style-src 'self' 'unsafe-inline';connect-src 'self';child-src 'none';object-src 'none'"
 
   # Strict-Transport-Security HTTP Strict Transport Security(HSTS) is a policy which is communicated by the server to the user agent via HTTP response header field name “Strict-Transport-Security”. HSTS policy specifies a period of time during which the user agent(browser) should only access the server in a secure fashion(https).
   ## secure_ssl_redirect=False

+ 1 - 1
desktop/conf/pseudo-distributed.ini.tmpl

@@ -95,7 +95,7 @@
   ## secure_browser_xss_filter=true
 
   # X-Content-Type-Options: nosniff This is a HTTP response header feature that helps prevent attacks based on MIME-type confusion.
-  ## secure_content_security_policy="img-src 'self' www.google-analytics.com; connect-src 'self'; child-src 'none'; object-src 'none'"
+  ## secure_content_security_policy="script-src 'self' 'unsafe-inline' 'unsafe-eval' *.google-analytics.com *.doubleclick.net *.mathjax.org data:;img-src 'self' *.google-analytics.com *.doubleclick.net data:;style-src 'self' 'unsafe-inline';connect-src 'self';child-src 'none';object-src 'none'"
 
   # Strict-Transport-Security HTTP Strict Transport Security(HSTS) is a policy which is communicated by the server to the user agent via HTTP response header field name “Strict-Transport-Security”. HSTS policy specifies a period of time during which the user agent(browser) should only access the server in a secure fashion(https).
   ## secure_ssl_redirect=False

+ 6 - 1
desktop/core/src/desktop/conf.py

@@ -193,7 +193,12 @@ SECURE_CONTENT_SECURITY_POLICY = Config(
   key="secure_content_security_policy",
   help=_('X-Content-Type-Options: nosniff This is a HTTP response header feature that helps prevent attacks based on MIME-type confusion.'),
   type=str,
-  default="img-src 'self' www.google-analytics.com; connect-src 'self'; child-src 'none'; object-src 'none'")
+  default="script-src 'self' 'unsafe-inline' 'unsafe-eval' *.google-analytics.com *.doubleclick.net *.mathjax.org data:;"+
+          "img-src 'self' *.google-analytics.com *.doubleclick.net data:;"+
+          "style-src 'self' 'unsafe-inline';"+
+          "connect-src 'self';"+
+          "child-src 'none';"+
+          "object-src 'none'")
 
 SECURE_SSL_REDIRECT = Config(
   key="secure_ssl_redirect",