File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ const args = minimist(process.argv, {
3636 'help' ,
3737 'verbose' ,
3838 'wrap-iframe' ,
39- 'enable-sync'
39+ 'enable-sync' ,
40+ 'trusted-types'
4041 ] ,
4142 string : [
4243 'scheme' ,
@@ -53,6 +54,7 @@ if (args.help) {
5354 'yarn web [options]\n' +
5455 ' --no-launch Do not open VSCode web in the browser\n' +
5556 ' --wrap-iframe Wrap the Web Worker Extension Host in an iframe\n' +
57+ ' --trusted-types Enable trusted types (report only)\n' +
5658 ' --enable-sync Enable sync by default\n' +
5759 ' --scheme Protocol (https or http)\n' +
5860 ' --host Remote host\n' +
@@ -396,7 +398,13 @@ async function handleRoot(req, res) {
396398 . replace ( '{{WEBVIEW_ENDPOINT}}' , '' )
397399 . replace ( '{{REMOTE_USER_DATA_URI}}' , '' ) ;
398400
399- res . writeHead ( 200 , { 'Content-Type' : 'text/html' } ) ;
401+
402+ const headers = { 'Content-Type' : 'text/html' } ;
403+ if ( args [ 'trusted-types' ] ) {
404+ headers [ 'Content-Security-Policy-Report-Only' ] = 'require-trusted-types-for \'script\';' ;
405+ }
406+
407+ res . writeHead ( 200 , headers ) ;
400408 return res . end ( data ) ;
401409}
402410
You can’t perform that action at this time.
0 commit comments