From 13e59e5bc19b11517a67150d7414c583b1e6e829 Mon Sep 17 00:00:00 2001 From: Thomas Nienhaus Date: Thu, 21 May 2026 10:39:21 +0200 Subject: [PATCH 1/2] fix for https://github.com/microsoft/vscode/issues/314339 --- src/vs/platform/networkFilter/common/domainMatcher.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/platform/networkFilter/common/domainMatcher.ts b/src/vs/platform/networkFilter/common/domainMatcher.ts index aafc49ea66148..8792930ddca15 100644 --- a/src/vs/platform/networkFilter/common/domainMatcher.ts +++ b/src/vs/platform/networkFilter/common/domainMatcher.ts @@ -120,7 +120,7 @@ export function extractDomainPattern(pattern: string): string { * @returns `true` if the domain matches the pattern. */ export function matchesDomainPattern(domain: string, pattern: string): boolean { - const normalizedPattern = normalizeDomain(extractDomainPattern(pattern), pattern.includes('://')); + const normalizedPattern = normalizeDomain(extractDomainPattern(pattern), true); if (!normalizedPattern) { return false; } From 941f8395848b869982770e1db6030840ee305b95 Mon Sep 17 00:00:00 2001 From: Thomas Nienhaus Date: Thu, 21 May 2026 10:49:59 +0200 Subject: [PATCH 2/2] added tests --- .../networkFilter/test/common/domainMatcher.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/vs/platform/networkFilter/test/common/domainMatcher.test.ts b/src/vs/platform/networkFilter/test/common/domainMatcher.test.ts index 43c70da1eb22f..a5667c0e7b42c 100644 --- a/src/vs/platform/networkFilter/test/common/domainMatcher.test.ts +++ b/src/vs/platform/networkFilter/test/common/domainMatcher.test.ts @@ -134,6 +134,11 @@ suite('domainMatcher', () => { test('returns false for invalid pattern', () => { assert.strictEqual(matchesDomainPattern('example.com', ''), false); }); + + test('matches localhost pattern', () => { + assert.strictEqual(matchesDomainPattern('localhost', 'localhost'), true); + assert.strictEqual(matchesDomainPattern('localhost', 'other.com'), false); + }); }); suite('extractDomainFromUri', () => { @@ -184,5 +189,10 @@ suite('domainMatcher', () => { assert.strictEqual(isDomainAllowed('api.example.com', ['*.example.com'], []), true); assert.strictEqual(isDomainAllowed('api.example.com', [], ['*.example.com']), false); }); + + test('localhost is allowed when explicitly listed', () => { + assert.strictEqual(isDomainAllowed('localhost', ['localhost'], []), true); + assert.strictEqual(isDomainAllowed('localhost', [], ['localhost']), false); + }); }); });