Skip to content

Commit 62ee5bf

Browse files
Move list of trusted extensions to product.json & enable for Desktop (microsoft#165565)
Fixes microsoft/vscode-internalbacklog#3161 It's wild to me that we only allowed this on web originally. This should get rid of quite a few dialogs on Desktop.
1 parent 21e7770 commit 62ee5bf

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

src/vs/base/common/product.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export interface IProductConfiguration {
9090
readonly webExtensionTips?: readonly string[];
9191
readonly languageExtensionTips?: readonly string[];
9292
readonly trustedExtensionUrlPublicKeys?: { [id: string]: string[] };
93+
readonly trustedExtensionAuthAccess?: readonly string[];
9394

9495
readonly crashReporter?: {
9596
readonly companyName: string;

src/vs/workbench/services/authentication/browser/authenticationService.ts

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { flatten } from 'vs/base/common/arrays';
77
import { Emitter, Event } from 'vs/base/common/event';
88
import { IJSONSchema } from 'vs/base/common/jsonSchema';
99
import { Disposable, dispose, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
10-
import { isWeb } from 'vs/base/common/platform';
1110
import { isFalsyOrWhitespace } from 'vs/base/common/strings';
1211
import { isString } from 'vs/base/common/types';
1312
import * as nls from 'vs/nls';
@@ -26,7 +25,6 @@ import { AuthenticationProviderInformation, AuthenticationSession, Authenticatio
2625
import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
2726
import { ActivationKind, IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
2827
import { ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
29-
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
3028

3129
export function getAuthenticationProviderActivationEvent(id: string): string { return `onAuthenticationRequest:${id}`; }
3230

@@ -36,16 +34,6 @@ interface IAccountUsage {
3634
lastUsed: number;
3735
}
3836

39-
const FIRST_PARTY_ALLOWED_EXTENSIONS = [
40-
'vscode.git',
41-
'vscode.github',
42-
'github.vscode-pull-request-github',
43-
'github.remotehub',
44-
'github.remotehub-insiders',
45-
'github.codespaces',
46-
'ms-vsliveshare.vsliveshare'
47-
];
48-
4937
export function readAccountUsages(storageService: IStorageService, providerId: string, accountName: string,): IAccountUsage[] {
5038
const accountKey = `${providerId}-${accountName}-usages`;
5139
const storedUsages = storageService.get(accountKey, StorageScope.APPLICATION);
@@ -204,9 +192,9 @@ export class AuthenticationService extends Disposable implements IAuthentication
204192
@IActivityService private readonly activityService: IActivityService,
205193
@IExtensionService private readonly extensionService: IExtensionService,
206194
@IStorageService private readonly storageService: IStorageService,
207-
@IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService,
208195
@IDialogService private readonly dialogService: IDialogService,
209-
@IQuickInputService private readonly quickInputService: IQuickInputService
196+
@IQuickInputService private readonly quickInputService: IQuickInputService,
197+
@IProductService private readonly productService: IProductService,
210198
) {
211199
super();
212200

@@ -392,14 +380,7 @@ export class AuthenticationService extends Disposable implements IAuthentication
392380
: true;
393381
}
394382

395-
const remoteConnection = this.remoteAgentService.getConnection();
396-
// Right now, this is hardcoded to only happen in Codespaces and on web.
397-
// TODO: this should be determined by the embedder so that this logic isn't in core.
398-
const allowedAllowedExtensions = remoteConnection !== null
399-
? remoteConnection.remoteAuthority.startsWith('codespaces')
400-
: isWeb;
401-
402-
if (allowedAllowedExtensions && FIRST_PARTY_ALLOWED_EXTENSIONS.includes(extensionId)) {
383+
if (this.productService.trustedExtensionAuthAccess?.includes(extensionId)) {
403384
return true;
404385
}
405386

0 commit comments

Comments
 (0)