1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-01-03 10:31:54 +01:00

Block data URLs instead of their requests

Fixes #211
This commit is contained in:
kkapsner 2018-07-21 00:32:15 +02:00
parent 0ce446cf52
commit 9ba9c48422
6 changed files with 25 additions and 33 deletions

View File

@ -725,12 +725,12 @@
"description": ""
},
"blockRequestsFromDataURL_title": {
"message": "Anfragen von Data-URL Seiten blockieren",
"blockDataURLs_title": {
"message": "Data-URL Seiten blockieren",
"description": ""
},
"blockRequestsFromDataURL_description": {
"message": "Data-URL Seiten können nicht gegen Fingerprinting geschützt werden (siehe https://bugzilla.mozilla.org/show_bug.cgi?id=1475831). Indem Anfragen von Data-URL Seiten blockiert werden kann verhindert werden, dass der echte Fingerabdruck zu irgendeinem Server gelangt.",
"blockDataURLs_description": {
"message": "Data-URL Seiten können nicht gegen Fingerprinting geschützt werden (siehe https://bugzilla.mozilla.org/show_bug.cgi?id=1475831). Indem Data-URL Seiten blockiert werden kann verhindert werden, dass der echte Fingerabdruck zu irgendeinem Server gelangt.",
"description": ""
},

View File

@ -725,12 +725,12 @@
"description": ""
},
"blockRequestsFromDataURL_title": {
"message": "Block requests from data URL pages",
"blockDataURLs_title": {
"message": "Block data URL pages",
"description": ""
},
"blockRequestsFromDataURL_description": {
"message": "Data URL pages cannot be protected against fingerprinting (see https://bugzilla.mozilla.org/show_bug.cgi?id=1475831). Blocking requests from them prevents the real fingerprint to reach any server.",
"blockDataURLs_description": {
"message": "Data URL pages cannot be protected against fingerprinting (see https://bugzilla.mozilla.org/show_bug.cgi?id=1475831). Blocking them prevents the real fingerprint to reach any server.",
"description": ""
},

View File

@ -16,34 +16,25 @@
const logging = require("./logging");
const settings = require("./settings");
const dataUrlFrames = new Set();
scope.init = function(){
browser.webRequest.onBeforeRequest.addListener(
browser.webRequest.onHeadersReceived.addListener(
function(details){
if (
details.url.startsWith("data:text")
){
dataUrlFrames.add(details.frameId);
logging.message("Detected data URL", details);
}
else if (
settings.blockRequestsFromDataURL &&
dataUrlFrames.has(details.frameId)
){
logging.warning("Blocking request from data-URL frame.", details);
if (
settings.get("showNotifications")
){
browser.pageAction.show(details.tabId);
}
return {cancel: true};
const headers = details.responseHeaders;
if (settings.blockDataURLs){
logging.verbose("Adding CSP header to", details);
headers.push({
name: "Content-Security-Policy",
value: "object-src *; child-src *"
});
}
return {
responseHeaders: headers
};
},
{
urls: ["<all_urls>"]
},
["blocking"]
["blocking", "responseHeaders"]
);
};

View File

@ -206,7 +206,7 @@
}
},
{
name: "blockRequestsFromDataURL",
name: "blockDataURLs",
defaultValue: true
},
{

View File

@ -381,7 +381,7 @@
},
"misc",
{
"name": "blockRequestsFromDataURL",
"name": "blockDataURLs",
"displayDependencies": {
"displayAdvancedSettings": [true]
}

View File

@ -1,15 +1,16 @@
Version 0.5.1:
changes:
-
- instead of blocking requests from data URLs they are blocked themselfes
new features:
- new setting: session white list that is cleared on addon load (= browser start)
fixes:
- Changes made in the page action were not saved in all Firefox versions
- Blocking requests data URLs blocked too much
known issues:
- if a data URL request is blocked the page action button appears but shows no content
- if a data URL is blocked the page action button does not appear
Version 0.5.0.1b:
known issues: