Skip to content

Commit

Permalink
Add advanced setting dnsResolveEnabled
Browse files Browse the repository at this point in the history
Default to `true`.

Set to `false` to wholly disable calls to `dns.resolve()` (Firefox-
only). Disabling calls to `dns.resolve()` will prevent cname-uncloaking
and will limit ability to enforce `ipaddress` filter option.
  • Loading branch information
gorhill committed Sep 19, 2024
1 parent b01a418 commit 760b2ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions platform/firefox/vapi-background-ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ vAPI.Net = class extends vAPI.Net {
this.cnameIgnoreExceptions = true;
this.cnameIgnoreRootDocument = true;
this.cnameReplayFullURL = false;
this.dnsResolveEnabled = true;
}

setOptions(options) {
Expand Down Expand Up @@ -89,6 +90,9 @@ vAPI.Net = class extends vAPI.Net {
if ( 'cnameReplayFullURL' in options ) {
this.cnameReplayFullURL = options.cnameReplayFullURL === true;
}
if ( 'dnsResolveEnabled' in options ) {
this.dnsResolveEnabled = options.dnsResolveEnabled === true;
}
this.dnsList.fill(null);
this.dnsDict.clear();
}
Expand Down Expand Up @@ -256,6 +260,7 @@ vAPI.Net = class extends vAPI.Net {
}

dnsShouldResolve(hn) {
if ( this.dnsResolveEnabled === false ) { return false; }
if ( hn === '' ) { return false; }
const c0 = hn.charCodeAt(0);
if ( c0 === 0x5B /* [ */ ) { return false; }
Expand Down
1 change: 1 addition & 0 deletions src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const hiddenSettingsDefault = {
debugScriptletInjector: false,
differentialUpdate: true,
disableWebAssembly: false,
dnsResolveEnabled: true,
extensionUpdateForceReload: false,
filterAuthorMode: false,
loggerPopupType: 'popup',
Expand Down
1 change: 1 addition & 0 deletions src/js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ onBroadcast(msg => {
cnameIgnoreRootDocument: µbhs.cnameIgnoreRootDocument,
cnameMaxTTL: µbhs.cnameMaxTTL,
cnameReplayFullURL: µbhs.cnameReplayFullURL,
dnsResolveEnabled: µbhs.dnsResolveEnabled,
});
});

Expand Down

0 comments on commit 760b2ff

Please sign in to comment.