Skip to content

Commit 820f0ae

Browse files
committed
Add URL sanitizing check
1 parent 3386768 commit 820f0ae

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/helpers/domain.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const checkDomain = (host: string) => {
77
hasSubdomain: Boolean(parsed.subdomain),
88
subDomain: host,
99
domain: parsed.domain || host,
10+
isMullvadNet: parsed.domain === 'mullvad.net',
1011
};
1112
};
1213

src/helpers/socksProxy/socksProxy.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const handleProxyRequest = async (details: browser.proxy._OnRequestDetail
3030
const hostProxiesDetailsParsed: Record<string, ProxyDetails> = JSON.parse(hostProxiesDetails);
3131

3232
const currentHost = getCurrentHost(details);
33-
const { hasSubdomain, domain, subDomain } = checkDomain(currentHost);
33+
const { hasSubdomain, domain, subDomain, isMullvadNet } = checkDomain(currentHost);
3434
const currentDomain = hasSubdomain ? subDomain : domain;
3535

3636
const isDomainExcluded = excludedHostsParsed.includes(currentDomain);
@@ -51,8 +51,8 @@ export const handleProxyRequest = async (details: browser.proxy._OnRequestDetail
5151
// 3. When the request if a conncheck/DNS check originating from the extension,
5252
// we want to use the same proxy as the active tab, to get a consistent conncheck result
5353
const isExtensionRequest = details.documentUrl?.startsWith('moz-extension://');
54-
const isConnCheck = details.url?.endsWith('am.i.mullvad.net/json');
55-
const isDNSCheck = details.url?.endsWith('dnsleak.am.i.mullvad.net/');
54+
const isConnCheck = isMullvadNet && details.url?.endsWith('am.i.mullvad.net/json');
55+
const isDNSCheck = isMullvadNet && details.url?.endsWith('dnsleak.am.i.mullvad.net/');
5656

5757
const isExtConnCheck = isExtensionRequest && (isConnCheck || isDNSCheck);
5858

0 commit comments

Comments
 (0)