Skip to content

Commit 166f812

Browse files
committed
Sanitize connCheck URL
1 parent 3386768 commit 166f812

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/helpers/socksProxy/socksProxy.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ export const handleProxyRequest = async (details: browser.proxy._OnRequestDetail
5050

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
53-
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/');
53+
const { domain: maybeMullvadDomain } = checkDomain(details.url);
54+
const isMullvadNet = maybeMullvadDomain === 'mullvad.net';
5655

56+
const isExtensionRequest = details.documentUrl?.startsWith('moz-extension://');
57+
const isConnCheck = isMullvadNet && details.url?.endsWith('am.i.mullvad.net/json');
58+
const isDNSCheck = isMullvadNet && details.url?.endsWith('dnsleak.am.i.mullvad.net/');
5759
const isExtConnCheck = isExtensionRequest && (isConnCheck || isDNSCheck);
5860

5961
if (isExtConnCheck) {

0 commit comments

Comments
 (0)