@codingame/monaco-vscode-extensions-service-override 35.0.0 → 35.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-extensions-service-override",
3
- "version": "35.0.0",
3
+ "version": "35.0.1",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - extensions service-override",
6
6
  "keywords": [],
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "35.0.0",
19
- "@codingame/monaco-vscode-files-service-override": "35.0.0"
18
+ "@codingame/monaco-vscode-api": "35.0.1",
19
+ "@codingame/monaco-vscode-files-service-override": "35.0.1"
20
20
  },
21
21
  "main": "index.js",
22
22
  "module": "index.js",
@@ -4,7 +4,7 @@
4
4
  <meta http-equiv="Content-Security-Policy" content="
5
5
  default-src 'none';
6
6
  child-src 'self' data: blob:;
7
- script-src 'self' 'unsafe-eval' 'sha256-YenIR0w2uOJMq12UhbL15PlQWd7gf4v3ThVTe/nvZZE=' data: extension-file: https: http://localhost:* blob:;
7
+ script-src 'self' 'unsafe-eval' 'sha256-LfSEPWgJAtrOdr34EHjreixgIIu+NHGT7RYTpV0eCBA=' data: extension-file: https: http://localhost:* blob:;
8
8
  connect-src 'self' data: extension-file: https: wss: http://localhost:* http://127.0.0.1:* ws://localhost:* ws://127.0.0.1:*;"/>
9
9
  </head>
10
10
  <body>
@@ -13,14 +13,23 @@
13
13
  const searchParams = new URL(document.location.href).searchParams;
14
14
  const vscodeWebWorkerExtHostId = searchParams.get('vscodeWebWorkerExtHostId') || '';
15
15
  const name = searchParams.get('debugged') ? 'DebugExtensionHostWorker' : 'ExtensionHostWorker';
16
- const parentOrigin = searchParams.get('parentOrigin') || window.origin;
16
+ const parentOriginParam = searchParams.get('parentOrigin');
17
+ const parentOrigin = parentOriginParam || window.origin;
17
18
  const salt = searchParams.get('salt');
18
19
 
19
20
  (async function () {
20
21
  const hostnameValidationMarker = 'v--';
21
22
  const hostname = location.hostname;
22
23
  if (!hostname.startsWith(hostnameValidationMarker)) {
23
- // validation not requested
24
+ // Validation not requested by the hosting origin. In this configuration the iframe is
25
+ // expected to be same-origin with its parent, so a caller-supplied `parentOrigin` that
26
+ // differs from `window.origin` must be rejected. Otherwise an attacker who can trick a
27
+ // user into navigating to this static page could supply their own `parentOrigin`, receive
28
+ // the bootstrap handshake, and cause the iframe to `import()` attacker-controlled worker
29
+ // code inside the authenticated origin.
30
+ if (parentOriginParam && parentOriginParam !== window.origin) {
31
+ return sendError(new Error(`Refusing to load: 'parentOrigin' does not match window origin and hostname validation is not enabled.`));
32
+ }
24
33
  return start();
25
34
  }
26
35
  if (!crypto.subtle) {