Skip to content

Commit dd02a25

Browse files
committed
feat: rework Content-security policy to be more readable
1 parent e004923 commit dd02a25

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

netlify.toml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,33 @@
4949
for = "/news/*"
5050
[headers.values]
5151
# Additionally allow YouTube/Discourse frames and scripts and MathJax
52-
Content-Security-Policy = "default-src 'self'; style-src 'self' 'unsafe-inline'; script-src 'self' 'sha256-UPkidoMErzWw1gW/eY4LhAi9ZkPch3PP31d6KQoJ6Yc=' 'sha256-G40wI6OaLZXCtrb02xUq1H1kEVWjstzoQ0FXKwsWxPw=' 'sha256-1CldwzdEg2k1wTmf7s5RWVd7NMXI/7nxxjJM2C4DqII=' https://mixxx.discourse.group/javascripts/embed.js *.discourse-cdn.com; frame-src 'self' https://www.youtube-nocookie.com https://mixxx.discourse.group ; img-src 'self' https://i.ytimg.com https://raw.githubusercontent.com/mixxxdj/ ; connect-src 'self' https://mixxx.discourse.group https://*.discourse-cdn.com"
52+
# Allow only same-origin by default
53+
# See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/default-src
54+
Content-Security-Policy = '''
55+
default-src 'self';
56+
# Allow inline styles for MathJax, etc.
57+
style-src 'self' 'unsafe-inline';
58+
# Allow scripts from self, specific hashes (for MathJax), and Discourse embed
59+
script-src
60+
'self'
61+
'sha256-UPkidoMErzWw1gW/eY4LhAi9ZkPch3PP31d6KQoJ6Yc=' # TODO
62+
'sha256-G40wI6OaLZXCtrb02xUq1H1kEVWjstzoQ0FXKwsWxPw=' # TODO
63+
'sha256-1CldwzdEg2k1wTmf7s5RWVd7NMXI/7nxxjJM2C4DqII=' # MathJax
64+
https://mixxx.discourse.group/javascripts/embed.js
65+
*.discourse-cdn.com;
66+
# Allow frames from YouTube and Discourse
67+
frame-src
68+
'self'
69+
https://www.youtube-nocookie.com
70+
https://mixxx.discourse.group;
71+
# Allow images from self, YouTube thumbnails, and Mixxx GitHub repo
72+
img-src
73+
'self'
74+
https://i.ytimg.com
75+
https://raw.githubusercontent.com/mixxxdj/;
76+
# Allow connections to Discourse and its CDN, needed for Discourse embed
77+
connect-src
78+
'self'
79+
https://mixxx.discourse.group
80+
https://*.discourse-cdn.com
81+
'''

0 commit comments

Comments
 (0)