diff --git a/app/extensions/brave/content/scripts/blockCanvasFingerprinting.js b/app/extensions/brave/content/scripts/blockCanvasFingerprinting.js index 6d40115bf6b..bb0e5cbfe77 100644 --- a/app/extensions/brave/content/scripts/blockCanvasFingerprinting.js +++ b/app/extensions/brave/content/scripts/blockCanvasFingerprinting.js @@ -75,6 +75,11 @@ if (chrome.contentSettings.canvasFingerprinting == 'block') { function reportBlock (type) { var script_url = getOriginatingScriptUrl() + if (script_url) { + script_url = stripLineAndColumnNumbers(script_url) + } else { + script_url = window.location.href + } var msg = { type, scriptUrl: stripLineAndColumnNumbers(script_url) diff --git a/app/extensions/brave/locales/en-US/bravery.properties b/app/extensions/brave/locales/en-US/bravery.properties index dbccbe3592f..353dbd3da89 100644 --- a/app/extensions/brave/locales/en-US/bravery.properties +++ b/app/extensions/brave/locales/en-US/bravery.properties @@ -1,6 +1,7 @@ blockAds=Block Ads allowAdsAndTracking=Allow Ads and Tracking block3rdPartyCookie=Block 3rd Party Cookies +block3rdPartyFingerprinting=Block 3rd Party Fingerprinting httpsEverywhere=HTTPS Everywhere noScript=Block Scripts noScriptPref=Block Scripts (will break many sites) @@ -10,7 +11,9 @@ fingerprintingProtection=Fingerprinting Protection adControl=Ad Control cookieControl=Cookie Control allowAllCookies=Allow all cookies +allowAllFingerprinting=Allow all fingerprinting blockAllCookies=Block all cookies +blockAllFingerprinting=Block all fingerprinting adBlock=Ad Block showBraveAds=Show Brave Ads adsBlocked={[plural(blockedAdCount)]} diff --git a/app/extensions/brave/locales/en-US/preferences.properties b/app/extensions/brave/locales/en-US/preferences.properties index 71cc0dc3ca7..ac1bc6f9a01 100644 --- a/app/extensions/brave/locales/en-US/preferences.properties +++ b/app/extensions/brave/locales/en-US/preferences.properties @@ -203,7 +203,6 @@ offerSearchSuggestions=Autocomplete search term as you type doNotTrackTitle=Do Not Track doNotTrack=Send a 'Do Not Track' header with browsing requests * fullscreenContent=Full Screen Content -blockCanvasFingerprinting=Fingerprinting Protection (may break some sites) advancedSettingsTitle=Advanced Settings for Brave Payments advancedSettingsIcon.title=Advanced Settings ledgerRecoveryTitle=Recover your Brave wallet diff --git a/app/renderer/components/main/braveryPanel.js b/app/renderer/components/main/braveryPanel.js index 64343bab3f1..81f77affd1d 100644 --- a/app/renderer/components/main/braveryPanel.js +++ b/app/renderer/components/main/braveryPanel.js @@ -212,7 +212,8 @@ class BraveryPanel extends React.Component { props.noScriptEnabled = braverySettings.noScript props.httpsEnabled = braverySettings.httpsEverywhere props.adControl = braverySettings.adControl - props.isFpEnabled = braverySettings.fingerprintingProtection + props.isFpEnabled = braverySettings.fingerprintingProtection !== 'allowAllFingerprinting' + props.fingerprintingProtection = braverySettings.fingerprintingProtection props.cookieControl = braverySettings.cookieControl props.safeBrowsing = braverySettings.safeBrowsing props.isCompactBraveryPanel = getSetting(settings.COMPACT_BRAVERY_PANEL) @@ -515,7 +516,7 @@ class BraveryPanel extends React.Component { - + - + + + + + { } module.exports.runPostMigrations = (data) => { + // fingerprinting protection migration + if (typeof data.settings['privacy.block-canvas-fingerprinting'] !== 'boolean') { + return data + } + try { + const siteSettings = data.siteSettings + if (siteSettings) { + for (let host in siteSettings) { + if (siteSettings[host].fingerprintingProtection === true) { + siteSettings[host].fingerprintingProtection = 'blockAllFingerprinting' + } else if (siteSettings[host].fingerprintingProtection === false) { + siteSettings[host].fingerprintingProtection = 'allowAllFingerprinting' + } + } + } + data['fingerprintingProtectionAll'] = { + enabled: data.settings['privacy.block-canvas-fingerprinting'] + } + delete data.settings['privacy.block-canvas-fingerprinting'] + } catch (e) { + console.log('fingerprinting protection migration failed', e) + } return data } diff --git a/docs/state.md b/docs/state.md index 2deafd3502b..2ac017e1748 100644 --- a/docs/state.md +++ b/docs/state.md @@ -150,6 +150,12 @@ AppStore } } // the unique id of the extension }, + fingerprintingProtection: { + enabled: boolean // enable 3p fingerprinting blocking. default true. + }, + fingerprintingProtectionAll: { + enabled: boolean // enable all fingerprinting blocking. default false. + }, firstRunTimestamp: integer, flash: { enabled: boolean // enable flash @@ -253,7 +259,6 @@ AppStore 'payments.notificationTryPaymentsDismissed': boolean, // true if you dismiss the message or enable Payments 'privacy.autocomplete.history-size': number, // number of autocomplete entries to keep 'privacy.autofill-enabled': boolean, // true to enable autofill - 'privacy.block-canvas-fingerprinting': boolean, // canvas fingerprinting defense 'privacy.bookmark-suggestions': boolean, // auto suggest for bookmarks enabled 'privacy.do-not-track': boolean, // whether DNT is 1 'privacy.history-suggestions': boolean, // auto suggest for history enabled @@ -292,7 +297,7 @@ AppStore [hostPattern]: { adControl: string, // (showBraveAds | blockAds | allowAdsAndTracking) cookieControl: string, // (block3rdPartyCookie | allowAllCookies | blockAllCookies) - fingerprintingProtection: boolean, + fingerprintingProtection: string, // (block3rdPartyFingerprinting | allowAllFingerprinting | blockAllFingerprinting) flash: (number|boolean), // approval expiration time if allowed, false if never allow fullscreenPermission: boolean, geolocationPermission: boolean, diff --git a/js/about/preferences.js b/js/about/preferences.js index f3ea271653f..ac11b3a7204 100644 --- a/js/about/preferences.js +++ b/js/about/preferences.js @@ -46,6 +46,8 @@ const searchProviders = require('../data/searchProviders') const adblock = appConfig.resourceNames.ADBLOCK const cookieblock = appConfig.resourceNames.COOKIEBLOCK const cookieblockAll = appConfig.resourceNames.COOKIEBLOCK_ALL +const fingerprintingProtection = appConfig.resourceNames.FINGERPRINTING_PROTECTION +const fingerprintingProtectionAll = appConfig.resourceNames.FINGERPRINTING_PROTECTION_ALL const adInsertion = appConfig.resourceNames.AD_INSERTION const trackingProtection = appConfig.resourceNames.TRACKING_PROTECTION const httpsEverywhere = appConfig.resourceNames.HTTPS_EVERYWHERE @@ -88,7 +90,7 @@ const braveryPermissionNames = { 'cookieControl': ['string'], 'safeBrowsing': ['boolean'], 'httpsEverywhere': ['boolean'], - 'fingerprintingProtection': ['boolean'], + 'fingerprintingProtection': ['string'], 'noScript': ['boolean', 'number'] } @@ -488,6 +490,10 @@ class ShieldsTab extends ImmutableComponent { aboutActions.setResourceEnabled(cookieblock, e.target.value === 'block3rdPartyCookie') aboutActions.setResourceEnabled(cookieblockAll, e.target.value === 'blockAllCookies') } + onChangeFingerprintingProtection (e) { + aboutActions.setResourceEnabled(fingerprintingProtection, e.target.value === 'block3rdPartyFingerprinting') + aboutActions.setResourceEnabled(fingerprintingProtectionAll, e.target.value === 'blockAllFingerprinting') + } onToggleSetting (setting, e) { aboutActions.setResourceEnabled(setting, e.target.value) } @@ -513,10 +519,18 @@ class ShieldsTab extends ImmutableComponent {