提交 f3297e37 编写于 作者: R Rachel Macfarlane

Add list of VSO allowed extensions

上级 e58fca86
...@@ -17,6 +17,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands'; ...@@ -17,6 +17,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput'; import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService } from 'vs/platform/notification/common/notification';
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys'; import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
interface AllowedExtension { interface AllowedExtension {
id: string; id: string;
...@@ -25,6 +26,8 @@ interface AllowedExtension { ...@@ -25,6 +26,8 @@ interface AllowedExtension {
const accountUsages = new Map<string, { [accountName: string]: string[] }>(); const accountUsages = new Map<string, { [accountName: string]: string[] }>();
const VSO_ALLOWED_EXTENSIONS = ['github.vscode-pull-request-github', 'github.vscode-pull-request-github-insiders', 'vscode.git'];
function addAccountUsage(providerId: string, accountName: string, extensionOrFeatureName: string) { function addAccountUsage(providerId: string, accountName: string, extensionOrFeatureName: string) {
const providerAccountUsage = accountUsages.get(providerId); const providerAccountUsage = accountUsages.get(providerId);
if (!providerAccountUsage) { if (!providerAccountUsage) {
...@@ -290,7 +293,8 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu ...@@ -290,7 +293,8 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
@IDialogService private readonly dialogService: IDialogService, @IDialogService private readonly dialogService: IDialogService,
@IStorageService private readonly storageService: IStorageService, @IStorageService private readonly storageService: IStorageService,
@INotificationService private readonly notificationService: INotificationService, @INotificationService private readonly notificationService: INotificationService,
@IStorageKeysSyncRegistryService private readonly storageKeysSyncRegistryService: IStorageKeysSyncRegistryService @IStorageKeysSyncRegistryService private readonly storageKeysSyncRegistryService: IStorageKeysSyncRegistryService,
@IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService
) { ) {
super(); super();
this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostAuthentication); this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostAuthentication);
...@@ -319,6 +323,11 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu ...@@ -319,6 +323,11 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
return true; return true;
} }
const remoteConnection = this.remoteAgentService.getConnection();
if (remoteConnection && remoteConnection.remoteAuthority === 'vsonline' && VSO_ALLOWED_EXTENSIONS.includes(extensionId)) {
return true;
}
const { choice } = await this.dialogService.show( const { choice } = await this.dialogService.show(
Severity.Info, Severity.Info,
nls.localize('confirmAuthenticationAccess', "The extension '{0}' wants to access the {1} account '{2}'.", extensionName, providerName, accountName), nls.localize('confirmAuthenticationAccess', "The extension '{0}' wants to access the {1} account '{2}'.", extensionName, providerName, accountName),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册