Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect against WebRTC leaking private IP address #969

Merged
merged 8 commits into from
Nov 1, 2016
28 changes: 25 additions & 3 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var pbStorage = require("storage");

var HeuristicBlocking = require("heuristicblocking");
var webrequest = require("webrequest");

var SocialWidgetLoader = require("socialwidgetloader");
window.SocialWidgetList = SocialWidgetLoader.loadSocialWidgetsFromFile("data/socialwidgets.json");

Expand All @@ -50,6 +49,7 @@ function Badger() {
badger.initializeCookieBlockList();
badger.initializeDNT();
badger.initializeUserAllowList();
badger.enableWebRTCProtection();
if (!badger.isIncognito) {badger.showFirstRunPage();}
}

Expand Down Expand Up @@ -158,7 +158,7 @@ Badger.prototype = {

/**
* Initialize the Cookieblock List:
* * Download list form eff
* * Download list from eff
* * Merge with existing cookieblock list if any
* * Add any new domains to the action map
* Set a timer to update every 24 hours
Expand All @@ -168,6 +168,27 @@ Badger.prototype = {
setInterval(this.updateCookieBlockList, utils.oneDay());
},

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs doc comment

/**
* (Currently Chrome only)
* Change default WebRTC handling browser policy to more
* private setting that only shows public facing IP address.
* Only update if user does not have the strictest setting enabled
**/
enableWebRTCProtection: function(){
// Return early if browser doesn't implement chrome.privacy
if (!chrome.privacy) {return;}
var cpn = chrome.privacy.network;
cpn.webRTCIPHandlingPolicy.get({}, function(result) {
if (result.value === 'disable_non_proxied_udp') {
return; // Current setting is stricter than our preferred setting
}

cpn.webRTCIPHandlingPolicy.set({ value: 'default_public_interface_only'},
function(){ // empty callback
});
});
},

/**
* Update the cookie block list with a new list
* add any new entries that already have a parent domain in the action_map
Expand Down Expand Up @@ -363,7 +384,8 @@ Badger.prototype = {

},

/**

/**
* Helper function returns a list of all blocked origins for a tab
* @param {Integer} tabId requested tab id as provided by chrome
* @returns {*} A dictionary of third party origins and their actions
Expand Down