mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-04 01:59:38 +02:00
Use a lower WebRTC mode on Firefox to hide private IP addresses
Releated issue: - https://github.com/gorhill/uBlock/issues/3009 Firefox implements differently the behavior of `disable_non_proxied_udp`, and this probably leads to more oft-misdiagnosed breakage. Example: https://www.reddit.com/r/firefox/comments/b4guyl/gotowebmeeting_same_unsupported_bs/
This commit is contained in:
parent
3b065a9418
commit
977178bef2
@ -111,9 +111,7 @@ vAPI.storage = chrome.storage.local;
|
|||||||
|
|
||||||
vAPI.browserSettings = (function() {
|
vAPI.browserSettings = (function() {
|
||||||
// Not all platforms support `chrome.privacy`.
|
// Not all platforms support `chrome.privacy`.
|
||||||
if ( chrome.privacy instanceof Object === false ) {
|
if ( chrome.privacy instanceof Object === false ) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// Whether the WebRTC-related privacy API is crashy is an open question
|
// Whether the WebRTC-related privacy API is crashy is an open question
|
||||||
@ -122,11 +120,7 @@ vAPI.browserSettings = (function() {
|
|||||||
// an iframe) for platforms where it's a non-issue.
|
// an iframe) for platforms where it's a non-issue.
|
||||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/9
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/9
|
||||||
// Some Chromium builds are made to look like a Chrome build.
|
// Some Chromium builds are made to look like a Chrome build.
|
||||||
webRTCSupported: (function() {
|
webRTCSupported: vAPI.webextFlavor.soup.has('chromium') === false || undefined,
|
||||||
if ( vAPI.webextFlavor.soup.has('chromium') === false ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
})(),
|
|
||||||
|
|
||||||
// Calling with `true` means IP address leak is not prevented.
|
// Calling with `true` means IP address leak is not prevented.
|
||||||
// https://github.com/gorhill/uBlock/issues/533
|
// https://github.com/gorhill/uBlock/issues/533
|
||||||
@ -145,16 +139,13 @@ vAPI.browserSettings = (function() {
|
|||||||
// place.
|
// place.
|
||||||
if ( setting ) { return; }
|
if ( setting ) { return; }
|
||||||
this.webRTCSupported = { setting: setting };
|
this.webRTCSupported = { setting: setting };
|
||||||
var iframe = document.createElement('iframe');
|
let iframe = document.createElement('iframe');
|
||||||
var me = this;
|
const messageHandler = ev => {
|
||||||
var messageHandler = function(ev) {
|
if ( ev.origin !== self.location.origin ) { return; }
|
||||||
if ( ev.origin !== self.location.origin ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
window.removeEventListener('message', messageHandler);
|
window.removeEventListener('message', messageHandler);
|
||||||
var setting = me.webRTCSupported.setting;
|
const setting = this.webRTCSupported.setting;
|
||||||
me.webRTCSupported = ev.data === 'webRTCSupported';
|
this.webRTCSupported = ev.data === 'webRTCSupported';
|
||||||
me.setWebrtcIPAddress(setting);
|
this.setWebrtcIPAddress(setting);
|
||||||
iframe.parentNode.removeChild(iframe);
|
iframe.parentNode.removeChild(iframe);
|
||||||
iframe = null;
|
iframe = null;
|
||||||
};
|
};
|
||||||
@ -175,12 +166,10 @@ vAPI.browserSettings = (function() {
|
|||||||
// WebRTC not supported: `webRTCMultipleRoutesEnabled` can NOT be
|
// WebRTC not supported: `webRTCMultipleRoutesEnabled` can NOT be
|
||||||
// safely accessed. Accessing the property will cause full browser
|
// safely accessed. Accessing the property will cause full browser
|
||||||
// crash.
|
// crash.
|
||||||
if ( this.webRTCSupported !== true ) {
|
if ( this.webRTCSupported !== true ) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var cp = chrome.privacy,
|
const cp = chrome.privacy;
|
||||||
cpn = cp.network;
|
const cpn = cp.network;
|
||||||
|
|
||||||
// Older version of Chromium do not support this setting, and is
|
// Older version of Chromium do not support this setting, and is
|
||||||
// marked as "deprecated" since Chromium 48.
|
// marked as "deprecated" since Chromium 48.
|
||||||
@ -210,9 +199,14 @@ vAPI.browserSettings = (function() {
|
|||||||
}, vAPI.resetLastError);
|
}, vAPI.resetLastError);
|
||||||
} else {
|
} else {
|
||||||
// https://github.com/uBlockOrigin/uAssets/issues/333#issuecomment-289426678
|
// https://github.com/uBlockOrigin/uAssets/issues/333#issuecomment-289426678
|
||||||
// - Leverage virtuous side-effect of strictest setting.
|
// Leverage virtuous side-effect of strictest setting.
|
||||||
|
// https://github.com/gorhill/uBlock/issues/3009
|
||||||
|
// Firefox currently works differently, use
|
||||||
|
// `default_public_interface_only` for now.
|
||||||
cpn.webRTCIPHandlingPolicy.set({
|
cpn.webRTCIPHandlingPolicy.set({
|
||||||
value: 'disable_non_proxied_udp',
|
value: vAPI.webextFlavor.soup.has('chromium')
|
||||||
|
? 'disable_non_proxied_udp'
|
||||||
|
: 'default_public_interface_only',
|
||||||
scope: 'regular'
|
scope: 'regular'
|
||||||
}, vAPI.resetLastError);
|
}, vAPI.resetLastError);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user