Skip to content

Add 'unsafe-inline' for style-src CSP #2105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/middleware/security_headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ impl SecurityHeaders {
// to load scripts. Remove 'unsafe-eval' if google fixes the issue:
// https://github.com/google/google-visualization-issues/issues/1356
// or if we switch to a different graph generation library.
//
// 'unsafe-inline' for style-src is necessary for Google Charts
headers.insert(
"Content-Security-Policy".into(),
vec![format!(
"default-src 'self'; \
connect-src 'self' https://docs.rs https://{}; \
script-src 'self' 'unsafe-eval' https://www.google.com; \
style-src 'self' https://www.google.com https://ajax.googleapis.com; \
style-src 'self' 'unsafe-inline' https://www.google.com https://ajax.googleapis.com; \
img-src *; \
object-src 'none'",
s3_host
Expand Down