Change:
<!-- Do Not Delete This! bugreporttemplate --<!-- Please read our Rules of Conduct: --<!-- Read our guide about submitting issues: --<!-- Search existing issues to avoid creating duplicates. --<!-- Test using the latest Insiders build to see if your issue has already been fixed: --<!-- Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. --<!-- Launch with to check. --Does this issue occur when all extensions are disabled?: Yes/No <!-- If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. --<!-- Issues caused by an extension need to be reported directly to the extension publisher. The 'Help Report Issue' dialog can assist with this. --- VS Code Version: OS Version: Steps to Reproduce: out of GitHub if you are logged in a trusted domain rule for GitHub Repos extension or something else, start a Login for GitHub Notice that you get prompted to allow this URL as a trusted domain No prompt This is because () doesn't handle query parameters well... and thinks they are part of the path when validating. You can see this behavior by adding a at the end of in the Trusted Domains. We should really ignore query parameters and fragments here.

Discussion:
private getConfiguredOpenerForUri(openers: Map<string, IExternalUriOpener>, targetUri: URI): IExternalUriOpener | 'default' | undefined { const config = this.configurationService.getValue<ExternalUriOpenersConfiguration>(externalUriOpenersSettingId) || {}; for (const [uriGlob, id] of Object.entries(config)) { <del> if (testUrlMatchesGlob(targetUri.toString(), uriGlob)) { </del> <ins> if (testUrlMatchesGlob(targetUri, uriGlob)) { </ins> if (id === defaultExternalUriOpenerId) { return 'default'; }

return true; } <del> if (testUrlMatchesGlob(url.toString(), trustedDomains[i])) { </del> <ins> if (testUrlMatchesGlob(url, trustedDomains[i])) { </ins> return true; } }

*  Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ <del> export const testUrlMatchesGlob = (url: string, globUrl: string): boolean => { </del> <ins> import { URI } from 'vs/base/common/uri'; // TODO: rewrite this to use URIs directly and validate each part individually // instead of relying on memoization of the stringified URI. export const testUrlMatchesGlob = (uri: URI, globUrl: string): boolean => { let url = uri.with({ query: null, fragment: null }).toString(); </ins> const normalize = (url: string) => url.replace(//+$/, ''); globUrl = normalize(globUrl); url = normalize(url);

linkAllowedByRules('https://github.com/microsoft/vscode/issues/new', ['https://github.com/microsoft']); linkAllowedByRules('https://github.com/microsoft/vscode/issues/new', ['https://github.com/microsoft']); }); <ins> test('ignore query & fragment - https://github.com/microsoft/vscode/issues/156839', () => { linkAllowedByRules('https://github.com/login/oauth/authorize?foo=4', ['https://github.com/login/oauth/authorize']); linkAllowedByRules('https://github.com/login/oauth/authorize#foo', ['https://github.com/login/oauth/authorize']); }); </ins> });