@@ -55,7 +55,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index
55
55
56
56
+ // It is safe to run if we are on the same host.
57
57
+ const parent = new URL(parentOrigin)
58
- + if (parent.hostname === location. hostname) {
58
+ + if (parent.hostname === hostname) {
59
59
+ return start(parentOrigin)
60
60
+ }
61
61
+
@@ -72,10 +72,42 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/index
72
72
73
73
+ // It is safe to run if we are on the same host.
74
74
+ const parent = new URL(parentOrigin)
75
- + if (parent.hostname === location. hostname) {
75
+ + if (parent.hostname === hostname) {
76
76
+ return start(parentOrigin)
77
77
+ }
78
78
+
79
79
if (!crypto.subtle) {
80
80
// cannot validate, not running in a secure context
81
81
throw new Error(`Cannot validate in current context!`);
82
+ Index: code-server/lib/vscode/src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html
83
+ ===================================================================
84
+ --- code-server.orig/lib/vscode/src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html
85
+ +++ code-server/lib/vscode/src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html
86
+ @@ -4,7 +4,7 @@
87
+ <meta http-equiv="Content-Security-Policy" content="
88
+ default-src 'none';
89
+ child-src 'self' data: blob:;
90
+ - script-src 'self' 'unsafe-eval' 'sha256-fh3TwPMflhsEIpR8g1OYTIMVWhXTLcjQ9kh2tIpmv54=' https:;
91
+ + script-src 'self' 'unsafe-eval' 'unsafe-inline' https:;
92
+ connect-src 'self' https: wss: http://localhost:* http://127.0.0.1:* ws://localhost:* ws://127.0.0.1:*;"/>
93
+ </head>
94
+ <body>
95
+ @@ -19,10 +19,18 @@
96
+ (async function() {
97
+ const hostnameValidationMarker = 'v--';
98
+ const hostname = location.hostname;
99
+ + console.log(hostname)
100
+ if (!hostname.startsWith(hostnameValidationMarker)) {
101
+ // validation not requested
102
+ return start();
103
+ }
104
+ +
105
+ + // It is safe to run if we are on the same host.
106
+ + const parent = new URL(parentOrigin)
107
+ + if (parent.hostname === hostname) {
108
+ + return start()
109
+ + }
110
+ +
111
+ if (!crypto.subtle) {
112
+ // cannot validate, not running in a secure context
113
+ return sendError(new Error(`Cannot validate in current context!`));
0 commit comments