fixed:解决security patch for high severity CVEs(6da39206214579d35f63a16ef571f4adb49c4b42)的编译错误.
This commit is contained in:
parent
08cd478fed
commit
afe5aedfef
|
@ -163,7 +163,7 @@ export class OpenerService implements IOpenerService {
|
|||
// validate against the original URI that this URI resolves to, if one exists
|
||||
const validationTarget = this._resolvedUriTargets.get(targetURI) ?? target;
|
||||
for (const validator of this._validators) {
|
||||
if (!(await validator.shouldOpen(validationTarget))) {
|
||||
if (!(await validator.shouldOpen(validationTarget, options))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ export class LinkDetector extends Disposable implements IEditorContribution {
|
|||
}
|
||||
}
|
||||
|
||||
return this.openerService.open(uri, { openToSide, fromUserGesture, allowContributedOpeners: true, allowCommands: true });
|
||||
return this.openerService.open(uri, { openToSide, fromUserGesture, allowContributedOpeners: true, allowCommands: true, fromWorkspace: true });
|
||||
|
||||
}, err => {
|
||||
const messageOrError =
|
||||
|
|
|
@ -41,6 +41,7 @@ export type OpenExternalOptions = {
|
|||
readonly openExternal?: boolean;
|
||||
readonly allowTunneling?: boolean;
|
||||
readonly allowContributedOpeners?: boolean | string;
|
||||
readonly fromWorkspace?: boolean;
|
||||
};
|
||||
|
||||
export type OpenOptions = OpenInternalOptions & OpenExternalOptions;
|
||||
|
@ -61,7 +62,7 @@ export interface IExternalOpener {
|
|||
}
|
||||
|
||||
export interface IValidator {
|
||||
shouldOpen(resource: URI | string): Promise<boolean>;
|
||||
shouldOpen(resource: URI | string, openOptions?: OpenOptions): Promise<boolean>;
|
||||
}
|
||||
|
||||
export interface IExternalUriResolver {
|
||||
|
|
|
@ -89,7 +89,7 @@ export class MainThreadWebviews extends Disposable implements extHostProtocol.Ma
|
|||
private onDidClickLink(handle: extHostProtocol.WebviewHandle, link: string): void {
|
||||
const webview = this.getWebview(handle);
|
||||
if (this.isSupportedLink(webview, URI.parse(link))) {
|
||||
this._openerService.open(link, { fromUserGesture: true, allowContributedOpeners: true, allowCommands: true });
|
||||
this._openerService.open(link, { fromUserGesture: true, allowContributedOpeners: true, allowCommands: true, fromWorkspace: true });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -713,7 +713,7 @@ var requirejs = (function() {
|
|||
}
|
||||
|
||||
if (linkToOpen) {
|
||||
this.openerService.open(linkToOpen, { fromUserGesture: true, allowCommands: false });
|
||||
this.openerService.open(linkToOpen, { fromUserGesture: true, allowCommands: false, fromWorkspace: true });
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import Severity from 'vs/base/common/severity';
|
|||
import { URI } from 'vs/base/common/uri';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IOpenerService, matchesScheme } from 'vs/platform/opener/common/opener';
|
||||
import { IOpenerService, matchesScheme, OpenOptions } from 'vs/platform/opener/common/opener';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
|
@ -45,7 +45,7 @@ export class OpenerValidatorContributions implements IWorkbenchContribution {
|
|||
@IConfigurationService private readonly _configurationService: IConfigurationService,
|
||||
@IWorkspaceTrustManagementService private readonly _workspaceTrustService: IWorkspaceTrustManagementService,
|
||||
) {
|
||||
this._openerService.registerValidator({ shouldOpen: r => this.validateLink(r) });
|
||||
this._openerService.registerValidator({ shouldOpen: (uri, options) => this.validateLink(uri, options) });
|
||||
|
||||
this._readAuthenticationTrustedDomainsResult = new IdleValue(() =>
|
||||
this._instantiationService.invokeFunction(readAuthenticationTrustedDomains));
|
||||
|
@ -64,12 +64,12 @@ export class OpenerValidatorContributions implements IWorkbenchContribution {
|
|||
});
|
||||
}
|
||||
|
||||
async validateLink(resource: URI | string): Promise<boolean> {
|
||||
async validateLink(resource: URI | string, openOptions?: OpenOptions): Promise<boolean> {
|
||||
if (!matchesScheme(resource, Schemas.http) && !matchesScheme(resource, Schemas.https)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this._workspaceTrustService.isWorkspaceTrusted() && !this._configurationService.getValue('workbench.trustedDomains.promptInTrustedWorkspace')) {
|
||||
if (openOptions?.fromWorkspace && this._workspaceTrustService.isWorkspaceTrusted() && !this._configurationService.getValue('workbench.trustedDomains.promptInTrustedWorkspace')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue