@@ -50,6 +50,8 @@ ts = moment(ts.timestamp).valueOf();
50
50
const sw = `sw.js${ process . env . NODE_ENV === 'production' ? '' : '?debug' } ` ;
51
51
const swScope = '/challenges' ; // we are currently only interested in improving challenges pages
52
52
53
+ const tcoPattern = new RegExp ( / ^ t c o \d { 2 } \. t o p c o d e r (?: - d e v ) ? \. c o m $ / i) ;
54
+
53
55
const EXTRA_SCRIPTS = [
54
56
`<script type="application/javascript">
55
57
if('serviceWorker' in navigator){
@@ -135,13 +137,14 @@ async function onExpressJsSetup(server) {
135
137
res . header ( 'Referrer-Policy' , 'strict-origin-when-cross-origin' ) ;
136
138
res . header ( 'Permissions-Policy' , 'geolocation=(), microphone=(), camera=()' ) ;
137
139
138
- if ( req . url . startsWith ( '/__community__/veterans' ) || req . hostname === 'veterans.topcoder.com' ) {
140
+ if ( req . url . startsWith ( '/__community__/veterans' ) || req . hostname === 'veterans.topcoder.com' || req . url . startsWith ( '/__community__/tco' ) || tcoPattern . test ( req . hostname ) ) {
139
141
res . header (
140
142
'Content-Security-Policy' ,
141
143
"default-src 'self';"
142
144
+ " script-src 'report-sample' 'self' 'unsafe-inline' 'unsafe-eval'"
143
145
+ ` ${ config . CDN . PUBLIC } `
144
146
+ ' http://www.google-analytics.com'
147
+ + ' https://www.google-analytics.com'
145
148
+ ' https://43d132d5dbff47c59d9d53ad448f93c2.js.ubembed.com'
146
149
+ ' https://assets.ubembed.com'
147
150
+ ' https://assets.zendesk.com'
@@ -187,6 +190,7 @@ async function onExpressJsSetup(server) {
187
190
+ ` ${ config . URL . AUTH } `
188
191
+ ' https://www.youtube.com;'
189
192
+ " img-src 'self'"
193
+ + ' data:'
190
194
+ ` ${ config . CDN . PUBLIC } `
191
195
+ ' https://cdn.segment.com'
192
196
+ ' https://d1of0acg2orgco.cloudfront.net'
@@ -196,11 +200,14 @@ async function onExpressJsSetup(server) {
196
200
+ ' https://heapanalytics.com'
197
201
+ ' https://q.quora.com'
198
202
+ ' https://topcoder-prod-media.s3.amazonaws.com'
203
+ + ' https://topcoder-dev-media.s3.amazonaws.com'
199
204
+ ' https://www.facebook.com'
200
205
+ ' https://www.google-analytics.com'
201
206
+ ' https://www.google.com'
202
207
+ ' https://www.googletagmanager.com'
203
- + ' https://i.ytimg.com;'
208
+ + ' https://i.ytimg.com'
209
+ + ' https://images.contentful.com'
210
+ + ' https://d0.awsstatic.com/logos/;'
204
211
+ " manifest-src 'self';"
205
212
+ " media-src 'self';"
206
213
+ ' report-uri https://623d4c23f90d055298b24042.endpoint.csper.io/?v=0;'
0 commit comments