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

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.1",
3
+ "version": "35.0.3",
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.1",
19
- "@codingame/monaco-vscode-files-service-override": "35.0.1"
18
+ "@codingame/monaco-vscode-api": "35.0.3",
19
+ "@codingame/monaco-vscode-files-service-override": "35.0.3"
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-LfSEPWgJAtrOdr34EHjreixgIIu+NHGT7RYTpV0eCBA=' data: extension-file: https: http://localhost:* blob:;
7
+ script-src 'self' 'unsafe-eval' 'sha256-2EBQn+AFduI8Wb0riLwbeshEGP4dJlHornyvuFAgYnA=' 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>
@@ -18,49 +18,7 @@
18
18
  const salt = searchParams.get('salt');
19
19
 
20
20
  (async function () {
21
- const hostnameValidationMarker = 'v--';
22
- const hostname = location.hostname;
23
- if (!hostname.startsWith(hostnameValidationMarker)) {
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
- }
33
- return start();
34
- }
35
- if (!crypto.subtle) {
36
- // cannot validate, not running in a secure context
37
- return sendError(new Error(`Cannot validate in current context!`));
38
- }
39
-
40
- // Here the `parentOriginHash()` function from `src/vs/base/browser/iframe.ts` is inlined
41
- // compute a sha-256 composed of `parentOrigin` and `salt` converted to base 32
42
- /** @type {string} */
43
- let parentOriginHash;
44
- try {
45
- const strData = JSON.stringify({ parentOrigin, salt });
46
- const encoder = new TextEncoder();
47
- const arrData = encoder.encode(strData);
48
- const hash = await crypto.subtle.digest('sha-256', arrData);
49
- const hashArray = Array.from(new Uint8Array(hash));
50
- const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
51
- // sha256 has 256 bits, so we need at most ceil(lg(2^256-1)/lg(32)) = 52 chars to represent it in base 32
52
- parentOriginHash = BigInt(`0x${hashHex}`).toString(32).padStart(52, '0');
53
- } catch (err) {
54
- return sendError(err instanceof Error ? err : new Error(String(err)));
55
- }
56
-
57
- const requiredSubdomain = `${hostnameValidationMarker}${parentOriginHash}.`;
58
- if (hostname.substring(0, requiredSubdomain.length) === requiredSubdomain) {
59
- // validation succeeded!
60
- return start();
61
- }
62
-
63
- return sendError(new Error(`Expected '${requiredSubdomain}' as subdomain!`));
21
+ return start();
64
22
  })();
65
23
 
66
24
  function sendError(error) {