Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce trustedExtensionProtocolHandlers #194304

Merged
merged 2 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.83.0",
"distro": "7181d0c2e9094f4f9f90764e81ebac2443072cb7",
"distro": "e61050c5d43d2c66a196fafaa2b78d4f2a8c929a",
"author": {
"name": "Microsoft Corporation"
},
Expand Down Expand Up @@ -231,4 +231,4 @@
"optionalDependencies": {
"windows-foreground-love": "0.5.0"
}
}
}
1 change: 1 addition & 0 deletions src/vs/base/common/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export interface IProductConfiguration {
readonly languageExtensionTips?: readonly string[];
readonly trustedExtensionUrlPublicKeys?: IStringDictionary<string[]>;
readonly trustedExtensionAuthAccess?: readonly string[];
readonly trustedExtensionProtocolHandlers?: readonly string[];

readonly commandPaletteSuggestedCommandIds?: string[];

Expand Down
9 changes: 0 additions & 9 deletions src/vs/code/electron-main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
import { isLaunchedFromCli } from 'vs/platform/environment/node/argvHelper';
import { getResolvedShellEnv } from 'vs/platform/shell/node/shellEnv';
import { IExtensionUrlTrustService } from 'vs/platform/extensionManagement/common/extensionUrlTrust';
import { ExtensionUrlTrustService } from 'vs/platform/extensionManagement/node/extensionUrlTrustService';
import { IExtensionHostStarter, ipcExtensionHostStarterChannelName } from 'vs/platform/extensions/common/extensionHostStarter';
import { ExtensionHostStarter } from 'vs/platform/extensions/electron-main/extensionHostStarter';
import { IExternalTerminalMainService } from 'vs/platform/externalTerminal/electron-main/externalTerminal';
Expand Down Expand Up @@ -968,9 +966,6 @@ export class CodeApplication extends Disposable {
// Menubar
services.set(IMenubarMainService, new SyncDescriptor(MenubarMainService));

// Extension URL Trust
services.set(IExtensionUrlTrustService, new SyncDescriptor(ExtensionUrlTrustService));

// Extension Host Starter
services.set(IExtensionHostStarter, new SyncDescriptor(ExtensionHostStarter));

Expand Down Expand Up @@ -1118,10 +1113,6 @@ export class CodeApplication extends Disposable {
const urlChannel = ProxyChannel.fromService(accessor.get(IURLService), disposables);
mainProcessElectronServer.registerChannel('url', urlChannel);

// Extension URL Trust
const extensionUrlTrustChannel = ProxyChannel.fromService(accessor.get(IExtensionUrlTrustService), disposables);
mainProcessElectronServer.registerChannel('extensionUrlTrust', extensionUrlTrustChannel);

// Webview Manager
const webviewChannel = ProxyChannel.fromService(accessor.get(IWebviewManagerService), disposables);
mainProcessElectronServer.registerChannel('webview', webviewChannel);
Expand Down
13 changes: 0 additions & 13 deletions src/vs/platform/extensionManagement/common/extensionUrlTrust.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import { Action2, MenuId, registerAction2 } from 'vs/platform/actions/common/act
import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress';
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
import { IExtensionUrlTrustService } from 'vs/platform/extensionManagement/common/extensionUrlTrust';
import { CancellationToken } from 'vs/base/common/cancellation';

import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IProductService } from 'vs/platform/product/common/productService';

const FIVE_MINUTES = 5 * 60 * 1000;
const THIRTY_SECONDS = 30 * 1000;
Expand Down Expand Up @@ -121,7 +121,7 @@ class ExtensionUrlHandler implements IExtensionUrlHandler, IURLHandler {
@IConfigurationService private readonly configurationService: IConfigurationService,
@IProgressService private readonly progressService: IProgressService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IExtensionUrlTrustService private readonly extensionUrlTrustService: IExtensionUrlTrustService
@IProductService private readonly productService: IProductService
) {
this.userTrustedExtensionsStorage = new UserTrustedExtensionIdStorage(storageService);

Expand Down Expand Up @@ -166,7 +166,7 @@ class ExtensionUrlHandler implements IExtensionUrlHandler, IURLHandler {
}

const trusted = options?.trusted
|| (options?.originalUrl ? await this.extensionUrlTrustService.isExtensionUrlTrusted(extensionId, options.originalUrl) : false)
|| this.productService.trustedExtensionProtocolHandlers?.includes(extensionId)
|| this.didUserTrustExtension(ExtensionIdentifier.toKey(extensionId));

if (!trusted) {
Expand Down
1 change: 0 additions & 1 deletion src/vs/workbench/workbench.desktop.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ import 'vs/workbench/services/keybinding/electron-sandbox/nativeKeyboardLayout';
import 'vs/workbench/services/path/electron-sandbox/pathService';
import 'vs/workbench/services/themes/electron-sandbox/nativeHostColorSchemeService';
import 'vs/workbench/services/extensionManagement/electron-sandbox/extensionManagementService';
import 'vs/workbench/services/extensionManagement/electron-sandbox/extensionUrlTrustService';
import 'vs/workbench/services/encryption/electron-sandbox/encryptionService';
import 'vs/workbench/services/secrets/electron-sandbox/secretStorageService';
import 'vs/workbench/services/localization/electron-sandbox/languagePackService';
Expand Down
1 change: 0 additions & 1 deletion src/vs/workbench/workbench.web.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import 'vs/workbench/services/keybinding/browser/keyboardLayoutService';
import 'vs/workbench/services/extensions/browser/extensionService';
import 'vs/workbench/services/extensionManagement/browser/webExtensionsScannerService';
import 'vs/workbench/services/extensionManagement/common/extensionManagementServerService';
import 'vs/workbench/services/extensionManagement/browser/extensionUrlTrustService';
import 'vs/workbench/services/telemetry/browser/telemetryService';
import 'vs/workbench/services/url/browser/urlService';
import 'vs/workbench/services/update/browser/updateService';
Expand Down