Skip to content

Commit

Permalink
Update to 0.3.1, finalize first release for Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
dibollinger committed Apr 23, 2021
1 parent e2db80f commit 4e1811d
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 33 deletions.
2 changes: 1 addition & 1 deletion nodejs-feature-extractor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cookieblock-nodejs-feature-extractor",
"version": "0.3.0",
"version": "0.3.1",
"description": "Command line feature extractor that uses the same functions as the CookieBlock browser extension. Includes predictor for validation purposes.",
"main": "cli.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions src/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ Copyright (c) 2021 Dino Bollinger

With help from Karel Kubicek, Dr. Carlos Cotrini and Prof. Dr. David Basin.

Extension options HTML/CSS layout based on the Consent-O-Matic extension by Janus Bager Kristensen, Rolf Bagge, CAVI.

Logo design by Charmaine Coates.

Developed under the Department of Computer Science at ETH Zürich, Information Security Group.

---------------------------------------------------------------------------------

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
Expand Down
5 changes: 0 additions & 5 deletions src/_locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@
"manifestDescription": {
"message": "Blockiert Browser-Cookies deren Nutzung der Benutzer nicht zustimmt.",
"description": "Description of the extension."
},

"settingsSubtitle": {
"message": "Einstellungen",
"description": "Subtitle of the settings page."
}
}
49 changes: 37 additions & 12 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},

"firstTimeSubtitle": {
"message": "First Time Setup",
"message": "Initial Setup",
"description": "Subtitle of the first time setup page."
},

Expand All @@ -24,13 +24,33 @@
"description": "Greeting message on the first time setup."
},

"firstTimeDesc": {
"message": "CookieBlock attempts to automatically enforce your cookie consent preferences on all websites you visit. This is done through the user of a pre-trained machine learning classifier.",
"description": "Description seen on the first time setup page."
"optionsDescriptionPG1": {
"message": "CookieBlock allows you to automatically delete cookies that are used for purposes you do not consent towards. The categories you can choose from are listed below.",
"description": "Description paragraph 1 seen on the options page."
},

"optionsDescriptionPG2": {
"message": "Note that CookieBlock is still in early development, and the classifier may not be completely accurate. We would appreciate any feedback on the performance of the extension.",
"description": "Description paragraph 1 seen on the options page."
},

"firstTimeDescPG1": {
"message": "CookieBlock allows you to automatically delete cookies that are used for purposes you do not consent towards. The categories you can choose from are listed below.",
"description": "Description paragraph 1 seen on the first time setup page."
},

"firstTimeDescPG2": {
"message": "COOKIEBLOCK IS STILL IN EARLY DEVELOPMENT! It uses machine learning techniques to perform the classification, so the prediction may not always be accurate. If you notice that a website breaks, you can try to add an exception for that domain through the CookieBlock icon in the browser bar. This will prevent cookies originating from that website (but not third-parties) from being deleted. More fine-grained controls may be added in future versions.",
"description": "Description paragraph 2 seen on the first time setup page."
},

"firstTimeDescPG3": {
"message": "We would greatly appreciate feedback on the performance of the extension and whether there are any concrete cases of websites breaking.",
"description": "Description paragraph 3 seen on the first time setup page."
},

"consentDescription" : {
"message" : "Select the types of cookies that you would like websites to be able to set.",
"message" : "Select the types of cookies that you consent towards:",
"description" : "Description of the consent choices."
},

Expand All @@ -55,22 +75,22 @@
},

"catNecessaryDesc": {
"message": "This category includes cookies that are typically required for essential services to operate. Deleting these may cause websites to break.",
"message": "Strictly necessary cookies are required for essential services of the website to operate. Examples are cookies used for keeping track of the login state, or cookies used to keep track of shopping cart contents. Rejecting these cookies would cause websites to break, hence they are always enabled.",
"description": "Description of the 'Necessary' category."
},

"catFunctionalityDesc": {
"message": "Functionality cookies serve to remember optional user preferences, such as language or website style, and to improve the user experience. They are not required for essential services to work.",
"message": "Functionality cookies serve to remember optional user preferences, such as language or website style. They are typically not required for essential services to work, but we recommend enabling them to improve the user experience.",
"description": "Description of the 'Functionality' category."
},

"catAnalyticsDesc" : {
"message": "Analytics cookies are used to collect statistical information about how visitors use a website. Normally the collected data should be anonymized and not be sensitive.",
"message": "Analytics cookies are used to collect statistical information about how visitors use a website. This data is used to improve the site, and in principle does not require personal information. However, some websites may still collect sensitive data with these cookies.",
"description": "Description of the 'Analytics' category."
},

"catAdvertisingDesc" : {
"message": "Advertising cookies track visitors across multiple websites and collect sensitive, personally identifiable information. This is commonly used to construct a user profile for targeted advertising.",
"message": "Advertising cookies track visitors across the web to display personalized advertisements. This also encompasses all cookies that are used to collect sensitive, personally identifiable information for the purpose of tracking and the sale of data. To protect the user's privacy, we recommend rejecting consent for these types of cookies.",
"description": "Description of the 'Advertising' category."
},

Expand All @@ -95,7 +115,7 @@
},

"debugDescription" : {
"message": "ONLY USE THIS WHEN TESTING! Debug mode will skip the removal of cookies such that the assigned category can be verified manually.",
"message": "ONLY USE THIS FOR TESTING! Debug mode will skip the removal of cookies, and output debug information to the log, such that the assigned category can be verified manually.",
"description": "Debug Description."
},

Expand Down Expand Up @@ -135,7 +155,12 @@
},

"currentCookieEnforceDescription" : {
"message" : "Run the policy enforcement on all cookies currently stored by the browser. This will remove all current cookies that the automatic classifier assigns to cookies you did not agree to.",
"message" : "Run the policy enforcement on all cookies currently stored by the browser. This will remove all cookies that the automatic classifier assigns to cookies you did not consent towards.",
"description" : "Description of the policy enforcement on current cookies."
},

"currentCookieEnforceDescriptionSetup" : {
"message" : "The button below will enforce the policy you selected above on all cookies currently stored in your browser. This will remove any cookies that the classifier assigns to categories you did not consent towards. You can also skip this step if you want to keep the current cookies.",
"description" : "Description of the policy enforcement on current cookies."
},

Expand All @@ -160,7 +185,7 @@
},

"globalExceptionsDescription" : {
"message" : "Cookies that originate from one of the domains in this list will always be permitted, regardless of the current consent policy.",
"message" : "Cookies that originate from the domains in this list will always be permitted, regardless of the current consent policy. Use this to add exceptions to domains you trust, or if website functionality breaks.",
"description" : "Decription for the global website exceptions."
},

Expand Down
8 changes: 4 additions & 4 deletions src/background/cookieblock_background.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,12 @@ const enforcePolicy = async function (ckey, cookieDat){
if (globalExcepts.includes(ckDomain)) {
console.debug(`Cookie found in domain whitelist: (${ckey})`);
localStatsCounter[4] += 1;
//await setStatsCounter(localStatsCounter);
await setStatsCounter(localStatsCounter);
} else {
// classify the cookie
let label = await classifyCookie(serializedCookie);
localStatsCounter[label] += 1;
//await setStatsCounter(localStatsCounter);
await setStatsCounter(localStatsCounter);

// make a decision
let dstate = await getDebugState();
Expand Down Expand Up @@ -310,12 +310,12 @@ const cookieChangeListener = function(changeInfo) {
if (globalExcepts.includes(ckDomain)) {
console.debug(`Cookie found in domain whitelist: (${ckey})`);
localStatsCounter[4] += 1;
//setStatsCounter(localStatsCounter);
await setStatsCounter(localStatsCounter);
} else {
// classify the cookie
let label = await classifyCookie(serializedCookie);
localStatsCounter[label] += 1;
//setStatsCounter(localStatsCounter);
await setStatsCounter(localStatsCounter);

// make a decision
let dstate = await getDebugState();
Expand Down
4 changes: 2 additions & 2 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "__MSG_extensionName__",
"author": "Dino Bollinger",
"homepage_url": "https://github.com/dibollinger/CookieBlock",
"version": "0.3.0",
"version": "0.3.1",
"incognito": "spanning",
"default_locale": "en",

Expand Down Expand Up @@ -52,7 +52,7 @@
"browser_specific_settings": {
// Firefox
"gecko": {
"id": "cookieblock@example.com" // intentionally not the real address
"id": "cookie.block.extension@gmail.com"
}
}
}
1 change: 0 additions & 1 deletion src/options/cookieblock_options.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ fieldset {

.disabled {
opacity: 0.5;
filter: grayscale(100%);
}

.preference_form {
Expand Down
23 changes: 22 additions & 1 deletion src/options/cookieblock_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ const handleExceptionSubmit = async function(inputID, storageID, listID) {
}
}

/**
* Helper to enable the necessary checkbox
* @param {Boolean} debugState
*/
const enableNecessaryCheckbox = async function(debugState) {
document.getElementById("debug_checkbox").checked = debugState;
let nCB = document.getElementById("nec_checkbox");
nCB.disabled = !debugState;
nCB.style.opacity = debugState ? "1.0" : "0.5";
nCB.style.filter = debugState ? "grayscale(0%)" : "grayscale(100%)";
if (!debugState) {
let policy = await getUserPolicy();
policy[0] = true;
setUserPolicy(policy);
}
}

/**
* Function that contains most of the localization text assignments.
Expand Down Expand Up @@ -168,6 +184,7 @@ const setupSettingsPage = async function() {

let debugState = await getDebugState();
document.getElementById("debug_checkbox").checked = debugState;
enableNecessaryCheckbox(debugState);

// Statistics
let sending = browser.runtime.sendMessage({"get_stats": true});
Expand All @@ -180,6 +197,8 @@ const setupSettingsPage = async function() {
setStaticLocaleText("num_uncat", "statsWhitelist", stats[4]);
});



}


Expand Down Expand Up @@ -239,7 +258,9 @@ const logStorageChange = function(changes, area) {
}
} else if (area === "local") {
if (changedItems.includes("cblk_debug")){
document.getElementById("nec_checkbox").checked = changes["cblk_debug"].newValue;
let debugState = changes["cblk_debug"].newValue;
enableNecessaryCheckbox(debugState);

} else if (changedItems.includes("cblk_counter")) {
stats = changes["cblk_counter"].newValue;
setStaticLocaleText("num_necessary", "statsNecessary", stats[0]);
Expand Down
4 changes: 3 additions & 1 deletion src/options/cookieblock_setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ <h2 id="init_subtitle"></h2>
<div class="contents">
<div class="description">
<div id="setup_greet" style="font-size: 1.75em; font-weight: bold;"></div>
<div id="setup_desc" class="overview_description"></div>
<div id="setup_desc1" class="overview_description"></div>
<div id="setup_desc2" class="overview_description"></div>
<div id="setup_desc3" class="overview_description"></div>
</div>
<hr class="thin">
<div class="settings_group">
Expand Down
14 changes: 8 additions & 6 deletions src/options/cookieblock_setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const toggleDebug = async function() {
setStaticLocaleText("init_subtitle", "firstTimeSubtitle");

setStaticLocaleText("setup_greet", "firstTimeGreeting");
setStaticLocaleText("setup_desc","firstTimeDesc");
setStaticLocaleText("setup_desc1","firstTimeDescPG1");
setStaticLocaleText("setup_desc2","firstTimeDescPG2");
setStaticLocaleText("setup_desc3","firstTimeDescPG3");

setStaticLocaleText("cprefs_legend", "optionsHeaderConsent");
setStaticLocaleText("cprefs_desc","consentDescription");
Expand All @@ -36,7 +38,7 @@ const toggleDebug = async function() {
setStaticLocaleText("debug_desc", "debugDescription");

setStaticLocaleText("classify_title", "currentCookieEnforceTitle");
setStaticLocaleText("classify_desc", "currentCookieEnforceDescription");
setStaticLocaleText("classify_desc", "currentCookieEnforceDescriptionSetup");
setStaticLocaleText("set_policy","buttonExitSetup");

}
Expand Down Expand Up @@ -67,16 +69,16 @@ const updateAndClassify = async function() {
setStaticLocaleText("apply_text", "currentCookieProgressMsg");
let sending = browser.runtime.sendMessage({"classify_all": true});
sending.then((msg) => {
console.log("Process completed.");
console.log(`Process completed with message: ${msg}.`);
setStaticLocaleText("apply_text", "currentCookieEnforceMsg");
});

await sending;

// close once done
browser.tabs.getCurrent(function(tab) {
browser.tabs.remove(tab.id, () => {});
})
//browser.tabs.getCurrent(function(tab) {
// browser.tabs.remove(tab.id, () => {});
//})
}

/**
Expand Down

0 comments on commit 4e1811d

Please sign in to comment.