disable-missing-vsda.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. diff --git a/src/vs/platform/sign/browser/signService.ts b/src/vs/platform/sign/browser/signService.ts
  2. index ec1e11b..8303040 100644
  3. --- a/src/vs/platform/sign/browser/signService.ts
  4. +++ b/src/vs/platform/sign/browser/signService.ts
  5. @@ -5,6 +5,2 @@
  6. -import { importAMDNodeModule, resolveAmdNodeModulePath } from '../../../amdX.js';
  7. -import { WindowIntervalTimer } from '../../../base/browser/dom.js';
  8. -import { mainWindow } from '../../../base/browser/window.js';
  9. -import { memoize } from '../../../base/common/decorators.js';
  10. import { IProductService } from '../../product/common/productService.js';
  11. @@ -13,30 +9,4 @@ import { ISignService } from '../common/sign.js';
  12. -declare module vsdaWeb {
  13. - export function sign(salted_message: string): string;
  14. -
  15. - // eslint-disable-next-line @typescript-eslint/naming-convention
  16. - export class validator {
  17. - free(): void;
  18. - constructor();
  19. - createNewMessage(original: string): string;
  20. - validate(signed_message: string): 'ok' | 'error';
  21. - }
  22. -
  23. - export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
  24. - export function init(module_or_path?: InitInput | Promise<InitInput>): Promise<unknown>;
  25. -}
  26. -
  27. -// Initialized if/when vsda is loaded
  28. -declare const vsda_web: {
  29. - default: typeof vsdaWeb.init;
  30. - sign: typeof vsdaWeb.sign;
  31. - validator: typeof vsdaWeb.validator;
  32. -};
  33. -
  34. -const KEY_SIZE = 32;
  35. -const IV_SIZE = 16;
  36. -const STEP_SIZE = KEY_SIZE + IV_SIZE;
  37. -
  38. export class SignService extends AbstractSignService implements ISignService {
  39. - constructor(@IProductService private readonly productService: IProductService) {
  40. + constructor(@IProductService _productService: IProductService) {
  41. super();
  42. @@ -44,53 +14,7 @@ export class SignService extends AbstractSignService implements ISignService {
  43. protected override getValidator(): Promise<IVsdaValidator> {
  44. - return this.vsda().then(vsda => {
  45. - const v = new vsda.validator();
  46. - return {
  47. - createNewMessage: arg => v.createNewMessage(arg),
  48. - validate: arg => v.validate(arg),
  49. - dispose: () => v.free(),
  50. - };
  51. - });
  52. - }
  53. -
  54. - protected override signValue(arg: string): Promise<string> {
  55. - return this.vsda().then(vsda => vsda.sign(arg));
  56. - }
  57. -
  58. - @memoize
  59. - private async vsda(): Promise<typeof vsda_web> {
  60. - const checkInterval = new WindowIntervalTimer();
  61. - let [wasm] = await Promise.all([
  62. - this.getWasmBytes(),
  63. - new Promise<void>((resolve, reject) => {
  64. - importAMDNodeModule('vsda', 'rust/web/vsda.js').then(() => resolve(), reject);
  65. -
  66. - // todo@connor4312: there seems to be a bug(?) in vscode-loader with
  67. - // require() not resolving in web once the script loads, so check manually
  68. - checkInterval.cancelAndSet(() => {
  69. - if (typeof vsda_web !== 'undefined') {
  70. - resolve();
  71. - }
  72. - }, 50, mainWindow);
  73. - }).finally(() => checkInterval.dispose()),
  74. - ]);
  75. -
  76. - const keyBytes = new TextEncoder().encode(this.productService.serverLicense?.join('\n') || '');
  77. - for (let i = 0; i + STEP_SIZE < keyBytes.length; i += STEP_SIZE) {
  78. - const key = await crypto.subtle.importKey('raw', keyBytes.slice(i + IV_SIZE, i + IV_SIZE + KEY_SIZE), { name: 'AES-CBC' }, false, ['decrypt']);
  79. - wasm = await crypto.subtle.decrypt({ name: 'AES-CBC', iv: keyBytes.slice(i, i + IV_SIZE) }, key, wasm);
  80. - }
  81. -
  82. - await vsda_web.default(wasm);
  83. -
  84. - return vsda_web;
  85. + throw new Error('error loading vsda');
  86. }
  87. - private async getWasmBytes(): Promise<ArrayBuffer> {
  88. - const url = resolveAmdNodeModulePath('vsda', 'rust/web/vsda_bg.wasm');
  89. - const response = await fetch(url);
  90. - if (!response.ok) {
  91. - throw new Error('error loading vsda');
  92. - }
  93. -
  94. - return response.arrayBuffer();
  95. + protected override signValue(_arg: string): Promise<string> {
  96. + throw new Error('error loading vsda');
  97. }
  98. diff --git a/src/vs/server/node/remoteExtensionHostAgentServer.ts b/src/vs/server/node/remoteExtensionHostAgentServer.ts
  99. index e7949d3..2a553cc 100644
  100. --- a/src/vs/server/node/remoteExtensionHostAgentServer.ts
  101. +++ b/src/vs/server/node/remoteExtensionHostAgentServer.ts
  102. @@ -8,3 +8,2 @@ import type * as http from 'http';
  103. import * as net from 'net';
  104. -import { createRequire } from 'node:module';
  105. import { performance } from 'perf_hooks';
  106. @@ -41,3 +40,2 @@ import { setupServerServices, SocketServer } from './serverServices.js';
  107. import { CacheControl, serveError, serveFile, WebClientServer } from './webClientServer.js';
  108. -const require = createRequire(import.meta.url);
  109. @@ -734,14 +732,3 @@ export async function createServer(address: string | net.AddressInfo | null, arg
  110. - const vsdaMod = instantiationService.invokeFunction((accessor) => {
  111. - const logService = accessor.get(ILogService);
  112. - const hasVSDA = fs.existsSync(join(FileAccess.asFileUri('').fsPath, '../node_modules/vsda'));
  113. - if (hasVSDA) {
  114. - try {
  115. - return require('vsda');
  116. - } catch (err) {
  117. - logService.error(err);
  118. - }
  119. - }
  120. - return null;
  121. - });
  122. + const vsdaMod = instantiationService.invokeFunction(() => null);