Skip to content

Commit 6794a43

Browse files
committed
add compiler-explorer.com to csp thingymabob
1 parent 73b0f6d commit 6794a43

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

Diff for: lib/csp.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@
2525
const _ = require('underscore');
2626

2727
const data = {
28-
'default-src': ["'self'", 'https://*.godbolt.org', 'localhost:*'],
29-
'style-src': ["'self'", "'unsafe-inline'", 'https://*.godbolt.org', 'localhost:*'],
30-
'script-src': ["'self'", "'unsafe-inline'", 'data:', 'https://*.godbolt.org', 'localhost:*',
28+
'default-src': ["'self'", 'https://*.godbolt.org', 'localhost:*', 'https://*.compiler-explorer.com'],
29+
'style-src': ["'self'", "'unsafe-inline'", 'https://*.godbolt.org', 'localhost:*', 'https://*.compiler-explorer.com'],
30+
'script-src': ["'self'", "'unsafe-inline'", 'data:', 'https://*.godbolt.org', 'localhost:*', 'https://*.compiler-explorer.com',
3131
'https://*.twitter.com', 'https://www.google-analytics.com',
3232
'https://apis.google.com', 'https://ssl.google-analytics.com', 'https://sentry.io/'],
33-
'img-src': ["'self'", 'https://*.godbolt.org', 'localhost:*', 'data:', 'https://www.google-analytics.com/',
33+
'img-src': ["'self'", 'https://*.godbolt.org', 'localhost:*', 'https://*.compiler-explorer.com', 'data:', 'https://www.google-analytics.com/',
3434
'https://syndication.twitter.com', 'https://ssl.google-analytics.com', 'https://csi.gstatic.com'],
35-
'font-src': ["'self'", 'data:', 'https://*.godbolt.org', 'localhost:*', 'https://fonts.gstatic.com',
35+
'font-src': ["'self'", 'data:', 'https://*.godbolt.org', 'localhost:*', 'https://*.compiler-explorer.com', 'https://fonts.gstatic.com',
3636
'https://themes.googleusercontent.com'],
37-
'frame-src': ["'self'", 'https://*.godbolt.org', 'localhost:*', 'https://www.google-analytics.com',
37+
'frame-src': ["'self'", 'https://*.godbolt.org', 'localhost:*', 'https://*.compiler-explorer.com', 'https://www.google-analytics.com',
3838
'https://accounts.google.com/', 'https://content.googleapis.com/',
3939
'https://sentry.io', 'https://platform.twitter.com/', 'https://syndication.twitter.com/'],
40-
'connect-src': ["'self'", '*', 'https://*.godbolt.org', 'localhost:*', 'https://api.github.com'],
41-
'media-src': ["'self'", 'https://ssl.gstatic.com', 'https://*.godbolt.org', 'localhost:*']
40+
'connect-src': ["'self'", '*', 'https://*.godbolt.org', 'localhost:*', 'https://*.compiler-explorer.com', 'https://api.github.com'],
41+
'media-src': ["'self'", 'https://ssl.gstatic.com', 'https://*.godbolt.org', 'localhost:*', 'https://*.compiler-explorer.com']
4242
};
4343

4444
module.exports = {

Diff for: test/csp-tests.js

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ describe('CSP', () => {
3434
csp.data[value].should.include.members(['https://*.godbolt.org', "'self'"])
3535
});
3636
});
37+
it('Should work in the compiler-explorer domain for every field', () => {
38+
Object.keys(csp.data).forEach(value => {
39+
csp.data[value].should.include.members(['https://*.compiler-explorer.com', "'self'"])
40+
});
41+
});
3742
it('Should work in a localhost environment for every field', () => {
3843
Object.keys(csp.data).forEach(value => {
3944
csp.data[value].should.include.members(['localhost:*', "'self'"])

0 commit comments

Comments
 (0)