Relax CSP settings in local.py to fix Stripe Connect issues
- Convert CSP settings to lists - Add 'unsafe-eval' and 'unsafe-inline' to script-src - Add 'blob:' to default-src as fallback - Update connect-src to include Stripe domains
This commit is contained in:
@@ -6,37 +6,41 @@ from .multitenancy import env, INSTALLED_APPS, MIDDLEWARE
|
|||||||
# CONTENT SECURITY POLICY (CSP)
|
# CONTENT SECURITY POLICY (CSP)
|
||||||
# Explicitly imported/re-defined here to ensure they are active in local dev
|
# Explicitly imported/re-defined here to ensure they are active in local dev
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
CSP_DEFAULT_SRC = ("'self'",)
|
CSP_DEFAULT_SRC = ["'self'", "blob:", "data:"]
|
||||||
CSP_SCRIPT_SRC = (
|
CSP_SCRIPT_SRC = [
|
||||||
"'self'",
|
"'self'",
|
||||||
|
"'unsafe-inline'",
|
||||||
|
"'unsafe-eval'",
|
||||||
"https://js.stripe.com",
|
"https://js.stripe.com",
|
||||||
"https://connect-js.stripe.com",
|
"https://connect-js.stripe.com",
|
||||||
"https://www.googletagmanager.com",
|
"https://www.googletagmanager.com",
|
||||||
"https://www.google-analytics.com",
|
"https://www.google-analytics.com",
|
||||||
"blob:", # Required for Stripe
|
"blob:", # Required for Stripe
|
||||||
)
|
]
|
||||||
CSP_STYLE_SRC = (
|
CSP_STYLE_SRC = [
|
||||||
"'self'",
|
"'self'",
|
||||||
"'unsafe-inline'", # Required for Stripe and many UI libraries
|
"'unsafe-inline'", # Required for Stripe and many UI libraries
|
||||||
)
|
"https://fonts.googleapis.com",
|
||||||
CSP_IMG_SRC = (
|
]
|
||||||
|
CSP_IMG_SRC = [
|
||||||
"'self'",
|
"'self'",
|
||||||
"data:",
|
"data:",
|
||||||
"https://*.stripe.com",
|
"https://*.stripe.com",
|
||||||
"https://www.google-analytics.com",
|
"https://www.google-analytics.com",
|
||||||
)
|
]
|
||||||
CSP_CONNECT_SRC = (
|
CSP_CONNECT_SRC = [
|
||||||
"'self'",
|
"'self'",
|
||||||
"https://api.stripe.com",
|
"https://api.stripe.com",
|
||||||
|
"https://connect-js.stripe.com",
|
||||||
"https://www.google-analytics.com",
|
"https://www.google-analytics.com",
|
||||||
"https://stats.g.doubleclick.net",
|
"https://stats.g.doubleclick.net",
|
||||||
)
|
]
|
||||||
CSP_FRAME_SRC = (
|
CSP_FRAME_SRC = [
|
||||||
"'self'",
|
"'self'",
|
||||||
"https://js.stripe.com",
|
"https://js.stripe.com",
|
||||||
"https://hooks.stripe.com",
|
"https://hooks.stripe.com",
|
||||||
"https://connect-js.stripe.com",
|
"https://connect-js.stripe.com",
|
||||||
)
|
]
|
||||||
|
|
||||||
|
|
||||||
# GENERAL
|
# GENERAL
|
||||||
|
|||||||
Reference in New Issue
Block a user