commit d9112739d8fa41cbc9f061679019aaca0347786c Author: jsclary Date: Mon Jul 7 11:13:16 2014 -0500 Version 14.7.7.1 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..14f954b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Jason S. Clary + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..765fd81 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +RubberGlove +=========== + +Blocks common browser fingerprint techniques to improve your privacy. + +RubberGlove aims to reduce the ability of websites to globally fingerprint your browser. The Electronic Frontier Foundation's website, panopticlick.eff.org, and the associated study shows just how effective these techniques are for tracking you even without cookies. + +Currently it wraps the window.navigator and window.clientInformation objects to cloak plugins and mime types similar to the way Firefox and IE do. + +Planned future features: +* Reduction of detailed version information both in window.navigator and the http User-Agent header. +* Prevention of time skew and drift fingerprinting +* Prevention of canvas based fingerprinting + +Currently Chrome does not make it possible to get configuration information early enough in the page load to be useful. This may delay any features which need to be configured or selectively disabled. + +Please note that until this plugin or others like it are widely used, Panopticlick will likely still report your browser as unique despite the reduction in bits of identifying information. diff --git a/css/options.css b/css/options.css new file mode 100644 index 0000000..c4d52ac --- /dev/null +++ b/css/options.css @@ -0,0 +1,60 @@ +html { + width: 25em; +} +body { + margin: 0.20em; +} +a img { + border: 0; +} +.header { + border-bottom: 1px solid #92adef; + margin-bottom: 0.5em; +} +.footer { + border-top: 1px solid #92adef; + margin-top: 0.5em; + color: #BBBBBB; + font-size: 70%; + text-align: center; +} +.extensionTitle { + font-size: 200%; + font-weight: bold; + color: #92adef; +} +#extensionVersion { + font-size: 40%; +} +.extensionIcon { + float: left; + width: 4em; +} +.donateButton { + float: right; + width: 5em; +} +.quote { + font-size: 75%; +} +.quote .attribution { + font-weight: bold; + text-align: right; +} +.quote .publication { + font-style: italic; +} +.warningBox { + border: 1px solid #92adef; + border-radius: 0.25em; +} +.warningBox:not(:first-of-type) { + margin-top: 0.5em; +} +.warningBox:before { + content: 'WARNING'; + display: block; + text-align: center; + background-color: yellow; + border-bottom: 1px solid #92adef; +} diff --git a/html/options.html b/html/options.html new file mode 100644 index 0000000..3f78fe0 --- /dev/null +++ b/html/options.html @@ -0,0 +1,27 @@ + + + + + + + +
+ + +
+ RubberGlove + +
+
+ “Just because you're paranoid doesn't mean they aren't after you.” +
— Joseph Heller, Catch-22
+
+
+
+ Visit panopticlick.com to see it in action. +

Third-party cookies make fingerprinting unecessary. Disable third-party cookies in Chrome's privacy settings.

+

Plugins including Flash, Java, Quicktime and Silverlight expose additional information that's difficult to block. Plugins should be set to "Click to play" or disabled to minimize exposure.

+
+ + + \ No newline at end of file diff --git a/images/bitcoindonate.png b/images/bitcoindonate.png new file mode 100644 index 0000000..eb8f8e7 Binary files /dev/null and b/images/bitcoindonate.png differ diff --git a/images/icon128.png b/images/icon128.png new file mode 100644 index 0000000..a482503 Binary files /dev/null and b/images/icon128.png differ diff --git a/images/icon16.png b/images/icon16.png new file mode 100644 index 0000000..50814aa Binary files /dev/null and b/images/icon16.png differ diff --git a/images/icon19.png b/images/icon19.png new file mode 100644 index 0000000..5f33919 Binary files /dev/null and b/images/icon19.png differ diff --git a/images/icon32.png b/images/icon32.png new file mode 100644 index 0000000..50a9a77 Binary files /dev/null and b/images/icon32.png differ diff --git a/images/icon48.png b/images/icon48.png new file mode 100644 index 0000000..40a7e29 Binary files /dev/null and b/images/icon48.png differ diff --git a/images/icon64.png b/images/icon64.png new file mode 100644 index 0000000..96212b9 Binary files /dev/null and b/images/icon64.png differ diff --git a/js/background.js b/js/background.js new file mode 100644 index 0000000..e9b641a --- /dev/null +++ b/js/background.js @@ -0,0 +1,31 @@ +function resetBadgeCounter(tabId) { + localStorage['RubberGlove_BlockCount_' + tabId] = 0; + chrome.browserAction.setBadgeBackgroundColor({ color: [255, 0, 0, 255] }); + chrome.browserAction.setBadgeText({text: '', tabId: tabId}); +} + +function incrementBadgeCounter(tabId) { + var count = localStorage['RubberGlove_BlockCount_' + tabId] || 0; + localStorage['RubberGlove_BlockCount_' + tabId] = ++count; + chrome.browserAction.setBadgeBackgroundColor({ color: [255, 0, 0, 255] }); + chrome.browserAction.setBadgeText({text: count.toString(), tabId: tabId}); +} + +chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { + var response = {}; + switch(request.type) + { + case "increment-counter": + if(sender && sender.tab && sender.tab.id) + incrementBadgeCounter(sender.tab.id); + else console.error("RubberGlove: onMessage called without sender.tab.id"); + break; + } + if(sendResponse) sendResponse(response); +}); + +chrome.tabs.onUpdated.addListener(function(tabId,changeInfo,tab) { + if(changeInfo.status == "loading") { + resetBadgeCounter(tabId); + } +}); \ No newline at end of file diff --git a/js/bomOverride.js b/js/bomOverride.js new file mode 100644 index 0000000..7e720b6 --- /dev/null +++ b/js/bomOverride.js @@ -0,0 +1,122 @@ +window.navigator = window.clientInformation = function() { + var oldNavigator = navigator; + var altNav = {}; + var propertyNames = Object.getOwnPropertyNames(oldNavigator); + for(var propertyIndex = 0; propertyIndex < propertyNames.length; propertyIndex++) { + propertyName = propertyNames[propertyIndex]; + var descriptor = Object.getOwnPropertyDescriptor(navigator, propertyName); + if(typeof descriptor.value != 'undefined') + delete descriptor['value']; + if(typeof descriptor.get != 'undefined') + delete descriptor['get']; + var writable = false; + if(typeof descriptor.set != 'undefined') { + delete descriptor['set']; + writable = true; + } + if(typeof descriptor.writable != 'undefined') { + if(descriptor.writable == 'true') writable = true; + delete descriptor['writable']; + } + if(propertyName == 'plugins') { + console.log('RubberGlove: Cloaking plugins for ' + window.location.href); + var plugins = { }; + Object.defineProperty(plugins, 'length', { 'get': function() { + var eventNode = document.currentScript.parentNode; + return function() { + console.error('RubberGlove: Enumeration of navigator.plugins blocked for ' + window.location.href); + window.postMessage({ type: 'RubberGlove', text: 'navigator.plugins' }, '*'); + return 0; + }; + }(), enumerable: true}); + if(typeof descriptor.get == 'function') + delete descriptor['get']; + plugins.item = function() { + var item = function(index) { return; }; + item.toString = function() { return "function item() { [native code] }"; }; + return item; // function(index) { return item(index); }; + }(); + plugins.namedItem = function() { + var fakePlugins = plugins; + var namedItem = function(name) { return fakePlugins[name]; }; + namedItem.toString = function() { return "function namedItem() { [native code] }"; }; + return namedItem; //function(name) { return namedItem(name); }; + }(); + plugins.refresh = function() { + var fakePlugins = plugins; + var realPlugins = oldNavigator.plugins; + var refresh = function() { + realPlugins.refresh(); + for(var property in fakePlugins) { + if(property != 'refresh' && property != 'item' && property != 'namedItem' && property != 'length') { + delete fakePlugins[property]; + } + } + for(var n = 0; n < realPlugins.length; n++) { + var plugin = realPlugins[n]; + //console.log('RubberGlove: Cloaking \'' + plugin.name + '\''); + if(typeof plugin.name != 'undefined' && plugin.name != null && plugin.name != '' && plugin.name != ' ') + Object.defineProperty(fakePlugins, plugin.name, { 'value': plugin }); + } + }; + refresh.toString = function() { return "function refresh() { [native code] }"; }; + return refresh; //function() { return refresh(name); }; + }(); + plugins.refresh(); + descriptor.value = plugins; + } else if(propertyName == 'mimeTypes') { + console.log('RubberGlove: Cloaking mimeTypes for ' + window.location.href); + var mimeTypes = { }; + Object.defineProperty(mimeTypes, 'length', { 'get': function() { + var eventNode = document.currentScript.parentNode; + return function() { + console.error('RubberGlove: Enumeration of navigator.mimeTypes blocked'); + window.postMessage({ type: 'RubberGlove', text: 'navigator.mimeTypes' }, '*'); + return 0; + }; + }(), enumerable: true}); + if(typeof descriptor.get == 'function') + delete descriptor['get']; + mimeTypes.item = function() { + var item = function(index) { return; }; + item.toString = function() { return "function item() { [native code] }"; }; + return item; // function(index) { return item(index); }; + }(); + for(var n = 0; n < oldNavigator.mimeTypes.length; n++) { + var mimeType = oldNavigator.mimeTypes[n]; + //console.log('RubberGlove: Cloaking \'' + mimeType.type + '\''); + if(typeof mimeType.type != 'undefined' && mimeType.type != null && mimeType.type != '' && mimeType.type != ' ') + Object.defineProperty(mimeTypes, mimeType.type, { 'value': mimeType }); + } + descriptor.value = mimeTypes; + } else { + //console.log("RubberGlove: wrapping " + propertyName); + descriptor.get = function() { + var prop = propertyName; + var nav = oldNavigator; + return function() { return nav[prop] }; + }(); + if(writable) { + descriptor.set = function(value) { + var prop = propertyName; + var nav = oldNavigator; + return function() { nav[prop] = value; }; + }(); + } + } + Object.defineProperty(altNav, propertyName, descriptor); + } + for(propertyName in oldNavigator) { + if(typeof(oldNavigator[propertyName]) == "function") { + //console.log("RubberGlove: Wrapping function " + propertyName + "()"); + altNav[propertyName] = oldNavigator[propertyName]; + } + } + return altNav; +}(); + +if(document.currentScript.id == '_RubberGlove_removeHead') { + document.currentScript.parentNode.parentNode.removeChild(document.currentScript.parentNode); +} else { + document.currentScript.parentNode.removeChild(document.currentScript); +} \ No newline at end of file diff --git a/js/injectScripts.js b/js/injectScripts.js new file mode 100644 index 0000000..826095a --- /dev/null +++ b/js/injectScripts.js @@ -0,0 +1,37 @@ +//console.log("RubberGlove: Content Script for " + window.location.href); + +function loadScript(name) { + var request = new XMLHttpRequest(); + request.open('GET', chrome.runtime.getURL(name), false); + request.send(null); + if (request.status === 200) { + return request.responseText; + } + console.error("RubberGlove: Failed to load " + name); + return; +} + +var pageScripts = document.createElement('script'); +pageScripts.type = 'text/javascript'; +pageScripts.async = false; +pageScripts.text = loadScript("js/bomOverride.js"); + +var html = document.documentElement +var headTags = document.getElementsByTagName("head"); +var head = headTags.length > 0 ? head = headTags[0] : null; +if(!head || head != html.firstChild) { + head = document.createElement('head'); + html.insertBefore(head, html.firstChild); + pageScripts.id = "_RubberGlove_removeHead"; +} +window.addEventListener("message", function(event) { + if(event.source != window) return; + if(event.data.type && event.data.type == "RubberGlove") { + chrome.runtime.sendMessage({ + type: "increment-counter", + url: window.location.href, + message: event.data.text + }); + } +}); +head.insertBefore(pageScripts, head.firstChild); diff --git a/js/options.js b/js/options.js new file mode 100644 index 0000000..57c8b33 --- /dev/null +++ b/js/options.js @@ -0,0 +1,7 @@ +window.addEventListener('load', function() { + var extensionVersion = document.getElementById('extensionVersion'); + extensionVersion.appendChild(document.createTextNode(chrome.app.getDetails().version)); + + var bomViewer = document.getElementById("bomViewer"); + bomViewer.href = chrome.runtime.getURL("/html/bomViewer.html"); +}); diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..88b9049 --- /dev/null +++ b/manifest.json @@ -0,0 +1,39 @@ +{ + "manifest_version": 2, + "name": "RubberGlove", + "author": "Jason S. Clary", + "description": "Blocks common browser fingerprint techniques to improve your privacy.", + "version": "14.7.7.1", + "icons": { + "16": "images/icon16.png", + "19": "images/icon19.png", + "32": "images/icon32.png", + "48": "images/icon48.png", + "64": "images/icon64.png", + "128": "images/icon128.png" + }, + "content_scripts": [ + { + "matches": [ "*://*/*", "https://*/*", "file://*/*" ], + "js": ["js/injectScripts.js"], + "run_at": "document_start", + "all_frames": true + } + ], + "background": { + "scripts": ["js/background.js"], + "persistent": true + }, + "browser_action": { + "default_icon": "images/icon19.png", + "default_popup": "html/options.html" + }, + "permissions": [ + "tabs", + "privacy" + ], + "web_accessible_resources": [ + "js/bomOverride.js" + ], + "incognito": "spanning" +} \ No newline at end of file