@codingame/monaco-vscode-extensions-service-override 35.0.0 → 35.0.2
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.
|
|
3
|
+
"version": "35.0.2",
|
|
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.
|
|
19
|
-
"@codingame/monaco-vscode-files-service-override": "35.0.
|
|
18
|
+
"@codingame/monaco-vscode-api": "35.0.2",
|
|
19
|
+
"@codingame/monaco-vscode-files-service-override": "35.0.2"
|
|
20
20
|
},
|
|
21
21
|
"main": "index.js",
|
|
22
22
|
"module": "index.js",
|
package/vscode/src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html
CHANGED
|
@@ -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-
|
|
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,45 +13,12 @@
|
|
|
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
|
|
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 hostname = location.hostname;
|
|
22
|
-
if (!hostname.startsWith(hostnameValidationMarker)) {
|
|
23
|
-
// validation not requested
|
|
24
|
-
return start();
|
|
25
|
-
}
|
|
26
|
-
if (!crypto.subtle) {
|
|
27
|
-
// cannot validate, not running in a secure context
|
|
28
|
-
return sendError(new Error(`Cannot validate in current context!`));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Here the `parentOriginHash()` function from `src/vs/base/browser/iframe.ts` is inlined
|
|
32
|
-
// compute a sha-256 composed of `parentOrigin` and `salt` converted to base 32
|
|
33
|
-
/** @type {string} */
|
|
34
|
-
let parentOriginHash;
|
|
35
|
-
try {
|
|
36
|
-
const strData = JSON.stringify({ parentOrigin, salt });
|
|
37
|
-
const encoder = new TextEncoder();
|
|
38
|
-
const arrData = encoder.encode(strData);
|
|
39
|
-
const hash = await crypto.subtle.digest('sha-256', arrData);
|
|
40
|
-
const hashArray = Array.from(new Uint8Array(hash));
|
|
41
|
-
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
42
|
-
// sha256 has 256 bits, so we need at most ceil(lg(2^256-1)/lg(32)) = 52 chars to represent it in base 32
|
|
43
|
-
parentOriginHash = BigInt(`0x${hashHex}`).toString(32).padStart(52, '0');
|
|
44
|
-
} catch (err) {
|
|
45
|
-
return sendError(err instanceof Error ? err : new Error(String(err)));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const requiredSubdomain = `${hostnameValidationMarker}${parentOriginHash}.`;
|
|
49
|
-
if (hostname.substring(0, requiredSubdomain.length) === requiredSubdomain) {
|
|
50
|
-
// validation succeeded!
|
|
51
|
-
return start();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return sendError(new Error(`Expected '${requiredSubdomain}' as subdomain!`));
|
|
21
|
+
return start();
|
|
55
22
|
})();
|
|
56
23
|
|
|
57
24
|
function sendError(error) {
|