kgabryje commented on code in PR #24262:
URL: https://github.com/apache/superset/pull/24262#discussion_r1235211441
##########
superset/initialization/__init__.py:
##########
@@ -613,7 +613,11 @@ def __call__(
# Talisman
talisman_enabled = self.config["TALISMAN_ENABLED"]
- talisman_config = self.config["TALISMAN_CONFIG"]
+ talisman_config = (
+ self.config["TALISMAN_DEV_CONFIG"]
+ if self.superset_app.debug
+ else self.config["TALISMAN_CONFIG"]
+ )
Review Comment:
We must have "unsafe-eval" in dev mode - React and Webpack use it and
there's no way around it
##########
superset/config.py:
##########
@@ -1363,13 +1363,43 @@ def EMAIL_HEADER_MUTATOR( # pylint:
disable=invalid-name,unused-argument
CONTENT_SECURITY_POLICY_WARNING = True
# Do you want Talisman enabled?
-TALISMAN_ENABLED = False
+TALISMAN_ENABLED = True
# If you want Talisman, how do you want it configured??
TALISMAN_CONFIG = {
- "content_security_policy": None,
- "force_https": True,
+ "content_security_policy": {
+ "default-src": ["'self'"],
+ "img-src": ["'self'", "data:"],
+ "worker-src": ["'self'", "blob:"],
+ "connect-src": [
+ "'self'",
+ "https://api.mapbox.com",
+ "https://events.mapbox.com",
+ ],
+ "object-src": "'none'",
+ "style-src": ["'self'", "'unsafe-inline'"],
+ "script-src": ["'self'", "'strict-dynamic'"],
+ },
+ "content_security_policy_nonce_in": ["script-src"],
+ "force_https": False,
"force_https_permanent": False,
}
+# React requires `eval` to work correctly in dev mode
+TALISMAN_DEV_CONFIG = {
+ "content_security_policy": {
+ "default-src": ["'self'"],
+ "img-src": ["'self'", "data:"],
+ "worker-src": ["'self'", "blob:"],
+ "connect-src": [
+ "'self'",
+ "https://api.mapbox.com",
+ "https://events.mapbox.com",
+ ],
+ "object-src": "'none'",
+ "style-src": ["'self'", "'unsafe-inline'"],
+ "script-src": ["'self'", "'unsafe-inline'", "'unsafe-eval'"],
+ },
+ "content_security_policy_nonce_in": ["script-src"],
+}
Review Comment:
Yup nice catch!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]