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

Add support for TCFv2 and modernize the web extension #10

Open
wants to merge 148 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
9c63721
add eslint, fix indentation and spacing
Oct 4, 2021
d4e2efc
add gitignore
Oct 4, 2021
66d40d5
rm node_modules
Oct 4, 2021
681a041
Merge pull request #1 from katie-ta/kta--add-eslint
katie-ta Oct 5, 2021
5f89abc
fix vendor list request
Oct 7, 2021
a7b762c
Merge pull request #3 from katie-ta/kta--fix-vendor-list
charles-tan Oct 9, 2021
7260161
update uCookie to tcfV2
Oct 5, 2021
5e7cb97
update popup.js to tcfv2
Oct 9, 2021
3b6a6f1
Merge pull request #2 from katie-ta/kta--update-api
katie-ta Oct 9, 2021
9889f5a
add message for gdprApplies
Oct 9, 2021
71ad083
update GDPR applies message
Oct 16, 2021
cf46fb6
fix message
Oct 16, 2021
0c643bd
Merge pull request #10 from katie-ta/kta--gdpr-applies
katie-ta Oct 16, 2021
3524421
Fixes #4 by cleaning up code and adding listener in uCookie.js regard…
Oct 16, 2021
6926048
Style corrections responding to comments
Oct 16, 2021
4f28ae3
Merge pull request #12 from katie-ta/issue_4_cleanup_and_update_uCook…
charles-tan Oct 16, 2021
e91dde2
Related to Issue #6 to properly load the vendorsList
Oct 23, 2021
c454129
nit fix
Oct 23, 2021
bc50c24
Merge pull request #13 from katie-ta/issue_6_fix_load_vendors_list
charles-tan Oct 23, 2021
d2c4374
[WIP] use boilerplate
Oct 23, 2021
4892a4e
Merge branch 'main' of https://github.com/katie-ta/Cookie-Glasses
Oct 25, 2021
6dad86e
add back functionality to background.js
Oct 25, 2021
53b8c94
fix .gitignore
Oct 25, 2021
87494b6
fix gitignore
Oct 25, 2021
9c2eb24
fix comments
Oct 25, 2021
575f319
add try catch
Oct 25, 2021
6817721
rm unnecessary clearInterval
Oct 25, 2021
f9595b0
Merge pull request #14 from katie-ta/kta--boilerplate-module
katie-ta Oct 25, 2021
a3305bf
use api.tabs.connect
Nov 1, 2021
6116b61
clean up comments
Nov 1, 2021
51283be
#17 set up local storage, update popup.html from storage
Nov 5, 2021
cdf6787
rm unnecessary interval
Nov 5, 2021
dcf1982
Merge pull request #20 from katie-ta/kta--fix-connections
katie-ta Nov 6, 2021
a272bde
display relevant data from tcString
Nov 13, 2021
ac03532
Merge pull request #21 from katie-ta/kta--display-tc-data
katie-ta Nov 13, 2021
edd8784
add purposes to popup, update styling
Nov 13, 2021
2ebe4a9
dynamically update purposes
Nov 13, 2021
a4b57fc
change color of cmp
Nov 13, 2021
ea51677
Merge pull request #24 from katie-ta/kta--display-purposes
katie-ta Nov 13, 2021
9f6dd30
Improve local storage and timestamp handling and support refreshing page
Nov 13, 2021
1e561c6
Merge branch 'main' into support_reloading_and_improve_local_storage
Nov 13, 2021
f19e49b
Fix some console log messages
Nov 13, 2021
30578a9
nit fixes
Nov 13, 2021
bac5dac
nit fixes 2
Nov 13, 2021
15b2a20
Merge pull request #25 from katie-ta/support_reloading_and_improve_lo…
charles-tan Nov 13, 2021
0700c31
add show vendors functionality
Nov 14, 2021
b0393a4
add vendor list elements
Nov 14, 2021
c29ac47
resolve conflicts
Nov 14, 2021
0c2bda6
fix element id
Nov 14, 2021
aac0298
move all vendor utils into vendorUtils
Nov 14, 2021
5830c36
undo unnecessary diff
Nov 14, 2021
5394b1f
delete old unused logic
Nov 14, 2021
ce1629c
delete old unused logic
Nov 14, 2021
486e7c9
Merge pull request #27 from katie-ta/kta--show-vendors
katie-ta Nov 14, 2021
ac855ed
fix merge conflicts
Nov 14, 2021
f46ee2e
show vendors legitimate interests
Nov 14, 2021
8f2906d
Merge pull request #31 from katie-ta/kta--legit-interests
katie-ta Nov 14, 2021
0b941d4
show purpose legitimate interests
Nov 14, 2021
0d03c5b
update styling, combine vendors and purposes
Nov 14, 2021
82266cd
toggle show/hide buttons, only show purposes or vendors
Nov 14, 2021
634a3b5
allow for forced update of vendor list
Nov 14, 2021
b7bc563
Merge pull request #33 from katie-ta/kta--legit-interest-description
katie-ta Nov 14, 2021
b993679
add Cookie Glasses banner, add cmp decorator
Nov 14, 2021
17dfd05
add line-height to cmp decorator
Nov 14, 2021
8567ad7
Merge pull request #34 from katie-ta/kta--add-header
katie-ta Nov 14, 2021
f87c0dd
rm .DS_Store
Nov 24, 2021
a8d29cc
Merge pull request #35 from katie-ta/kta--rm-ds-store
katie-ta Nov 24, 2021
531c06e
[cmp] fetch and compile full cmp list
Nov 24, 2021
e84df79
Merge pull request #36 from katie-ta/kta--fetch-cmp-list-script
charles-tan Nov 28, 2021
dbdcfc1
add support for manual TC string decoding and fix some bugs
Nov 28, 2021
2eff809
Improve manual decoding UI experience
Nov 28, 2021
1541fd5
nit fixes
Nov 28, 2021
17b7c06
Merge pull request #37 from katie-ta/ctan--add-manual-decode-support-…
charles-tan Nov 28, 2021
a10d38a
add unknown cmp UI
Nov 28, 2021
b7fcfc5
fix cmp url
Nov 28, 2021
f75090f
add cmp url
Nov 28, 2021
52ccce1
delete outdated CMP list
Nov 28, 2021
5dc8101
fix css
Nov 28, 2021
cb49394
nit
Nov 28, 2021
5daf643
address comments
Nov 28, 2021
2bcc1cb
Merge pull request #38 from katie-ta/kta--use-new-cmp
katie-ta Nov 28, 2021
7020330
set icon accordingly
Nov 30, 2021
5d24353
update styling for decoder and info
Nov 30, 2021
b1a4968
fix num purposes
Nov 30, 2021
06c9f15
leave icon color if cmp not found
Nov 30, 2021
af753d6
update badge text when no purposes
Nov 30, 2021
06a63f0
Merge pull request #41 from katie-ta/kta--update-icon
katie-ta Dec 1, 2021
13d82f0
Merge vendors lists and expose some vendor fields
Dec 1, 2021
109f4a2
Merge branch 'main' into ctan--fix-vendors-list
Dec 1, 2021
0723166
add comment for restriction types
Dec 1, 2021
716f405
Merge pull request #43 from katie-ta/ctan--fix-vendors-list
charles-tan Dec 1, 2021
0dfd90a
add htmlUtils, make vendor list a table
Dec 1, 2021
daa5787
fix html util
Dec 1, 2021
53dd5c9
rearrange purposes
Dec 1, 2021
e79879c
reformat vendor lists
Dec 1, 2021
57ae05e
add features
Dec 2, 2021
a2d5210
add feature totals
Dec 2, 2021
f550baa
add vendor list description
Dec 2, 2021
a2aa80a
undo unnecessary diff
Dec 2, 2021
90720c4
Merge pull request #44 from katie-ta/kta--touch-ups
katie-ta Dec 2, 2021
03aba10
add purposeUtils, create combined purposes list
Dec 2, 2021
9771738
add special purposes
Dec 3, 2021
6e15006
reformat purpose button
Dec 3, 2021
c29cd8b
Merge pull request #48 from katie-ta/kta--combine-purposes
katie-ta Dec 3, 2021
f29ebe1
prettify error states
Dec 3, 2021
06131bf
Merge pull request #50 from katie-ta/kta--restyle-error-states
katie-ta Dec 4, 2021
646ddfb
add features as cols for show vendors
Dec 4, 2021
dd98006
Very nitty nit fixes
Dec 4, 2021
e8f66ed
Merge pull request #51 from katie-ta/ctan--add-features-as-cols
charles-tan Dec 4, 2021
dce88b8
update color scheme
Dec 4, 2021
d931868
reset badge text
Dec 4, 2021
c8a8030
add version styling
Dec 4, 2021
6bf86af
Merge pull request #53 from katie-ta/kta--restyle
katie-ta Dec 4, 2021
d505665
update README
katie-ta Dec 4, 2021
0adaa66
Update README
Dec 5, 2021
6080706
adjust some image sizes
Dec 5, 2021
a376457
small fixes to README layout
Dec 5, 2021
72216c6
grammar fixes
charles-tan Dec 5, 2021
d99fb2e
Apply suggestions from code review
charles-tan Dec 5, 2021
25e0f08
Small bug fix to unknown CMP UI and elaborate this section more in th…
Dec 5, 2021
46a7a29
Merge branch 'ctan--update-readme' of https://github.com/katie-ta/Coo…
Dec 5, 2021
c171e3b
make README images a little bigger
Dec 5, 2021
0a940f8
Delete old screenshots
Dec 5, 2021
6b32736
Merge pull request #55 from katie-ta/ctan--update-readme
charles-tan Dec 5, 2021
7c1696a
remove unused line
Dec 5, 2021
ae8a65c
update chrome installation instructions
katie-ta Dec 5, 2021
df36854
Fix special features text and related GIFs in README
Dec 5, 2021
731e517
Make README gifs smaller
Dec 5, 2021
b15e715
add css fixes for firefox
Dec 5, 2021
2960f1f
add details about VPN, update firefox installation
katie-ta Dec 5, 2021
a555182
add details about developer mode
katie-ta Dec 5, 2021
6a41098
bump major version
Dec 5, 2021
8d5ab68
Update README.md
katie-ta Dec 5, 2021
b30a793
Merge pull request #59 from katie-ta/ctan--fix-special-features-text
charles-tan Dec 5, 2021
c7e358e
Merge pull request #60 from katie-ta/kta--firefox
katie-ta Dec 5, 2021
9a89e03
make table header sticky
Dec 6, 2021
e2a415f
Merge pull request #61 from katie-ta/kta--vendor-header
katie-ta Dec 6, 2021
62ceefb
update fetch cmp list documentation
katie-ta Dec 6, 2021
430ed17
mv images into screenshots dir
Dec 6, 2021
3a213bf
clean up show purposes button
Dec 6, 2021
8e482e8
add iconUtils
Dec 6, 2021
1dfd8b2
update comments
Dec 6, 2021
70506da
Merge pull request #58 from katie-ta/kta--update-readme-installation
katie-ta Dec 6, 2021
98040fa
update download instructions
katie-ta Dec 6, 2021
a7f4867
Merge pull request #62 from katie-ta/kta--clean-up-codebase
katie-ta Dec 6, 2021
3246792
only update extension if gdprApplies = true
Dec 6, 2021
bdfc691
Merge pull request #63 from katie-ta/kta--gdpr-applies-fix
katie-ta Dec 6, 2021
4f9c4b0
Refetch CMP list, remove acorn and lodash dependencies which are not …
charles-tan Jan 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'airbnb-base',
],
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
},
rules: {
},
};
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.DS_Store
build
web-ext-artifacts/
node_modules/
99 changes: 61 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,101 @@
# Cookie Glasses
This browser extension shows you whether consent registered by cookie banners of IAB Europe's Transparency & Consent Framework corresponds to your choice

Update September 2020: CMPs switched to TCFv2 in August 2020. This extension only handles TCFv1 and is therefore obsolete unless it's adapted to the new TCF version (contact me if interested).
CookieGlasses is a browser extension that displays information registered by cookie banners implemented according to the IAB's [Transparency & Consent Framework (TCF)](https://iabeurope.eu/transparency-consent-framework/).

## Introduction

In the paper [Do Cookie Banners Respect my Choice? Measuring Legal Compliance of Banners from IAB Europe's Transparency and Consent Framework](https://arxiv.org/abs/1911.09964), we show that Consent Management Providers (CMPs) of IAB Europe's Transparency & Consent Framework (TCF) do not always respect user's choice. This extension allows you to verify that your consent is stored appropriately.
In the paper [Do Cookie Banners Respect my Choice? Measuring Legal Compliance of Banners from IAB Europe's Transparency and Consent Framework](https://arxiv.org/abs/1911.09964), it is shown that Consent Management Providers (CMPs) of IAB Europe's Transparency & Consent Framework (TCF) do not always respect user's choice. This extension allows you to verify that your consent is stored appropriately.

This extension for Firefox and Chrome queries CMPs of IAB Europe's TCF in the same position as a third-party advertiser, making it possible to see consent set by CMPs in real time.
In other words, you can see whether consent registered by cookie banners is actually the consent you gave.
Will only work with cookie banners of IAB Europe's TCF.
This extension for Firefox and Chrome queries CMPs of IAB Europe's TCF in the same position as a third-party advertiser, making it possible to see consent set by CMPs in real time. In other words, you can see whether consent registered by cookie banners is actually the consent you gave.
This extension only works with cookie banners of [IAB Europe's TCF](https://iabeurope.eu/transparency-consent-framework/).

![User interface of the extension](extension_popup.png?raw=true "User interface")
<img width="512" alt="Screen Shot 2021-12-04 at 1 41 32 AM" src="https://user-images.githubusercontent.com/16495787/144700617-de120d8e-9c75-4ea2-826d-9aa7242ae54e.png">

We also added a functionality to manually decode a so-called "consent string" of the framework.
The extension obtains its information via the TCF Consent String (TCString), obtained from [IAB's public API's](https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20CMP%20API%20v2.md).

Author: Célestin Matte (Université Côte d'Azur, Inria, France)
Contributors: Katie Ta, Charles Tan (Providence, RI, USA)

This is a research project made at Inria. Stage: complete. TCFv2 support might be added later.
## Features

## Install
Based on the TC string from the CMP, we decode and show the following information on the browser extension
- The TCF data processing purposes you've consented to and the purposes that are allowed based on legitimate interests
- List of all the vendors who are allowed to process your data and a list of the data processing purposes and features for each vendor
- Several aggregate values including the number of active and inactive vendors (inactive means they are allowed to process your data but you've rejected all of the purposes for which they would process your data)

<img src="./screenshots/cookie-glasses-purposes.gif" alt="purposes" width="256"/> <img src="./screenshots/cookie-glasses-features.gif" alt="features" width="256"/>

You can either install the extension from browsers' addon stores (simple, easy), or manually install it from source.
Other features:
- Functionality to manually decode a so-called "consent string" of the framework
- Communicates if the current webpage does not implement the TCF

### Install from addon store
<img src="./screenshots/manual_decode_tcstring.png" alt="manual_decode" width="512"/>
<img src="./screenshots/no_cmp_found.png" alt="no_cmp" width="512"/>

Chrome / Chromium : https://chrome.google.com/webstore/detail/cookie-glasses/gncnjghkclkhpkfhghcbobednpchjifk
#### Update the CMP list

Firefox: https://addons.mozilla.org/fr/firefox/addon/cookie-glasses/
Run the `fetch_cmp_list.py` script to scrape the IAB website (https://iabeurope.eu/cmp-list/) to get the most up-to-date CMP list information and save it to `cmp_list_full.json`. According to the IAB documentation, the list can change daily, but in practice, we've observed it changes less frequently.

### Manual install from source:
```
python3 Cookie-Glasses/src/scripts/fetch_cmp_list.py
```

The extension has been tested on Firefox, Chromium and Firefox mobile.
Any CMP not included in the list provided by IAB is either not compliant or not registered with the TCF, and the extension will warn the user accordingly:

#### Chrome / Chromium
<img src="./screenshots/unknown_cmp.png" alt="no_cmp" width="512"/>

Ideally we should fetch the list regularly, and we hope to provide future functionality to get the latest CMP list directly from the extension ([Issue #56](https://github.com/katie-ta/Cookie-Glasses/issues/56)).

## Install

1. Download the ZIP file of Cookie Glasses on your computer.
![Location of the zip file](https://camo.githubusercontent.com/71c8e3ec5ddbd2cac3b1d6469311f6bbf26c6465/68747470733a2f2f692e696d6775722e636f6d2f47784f6d6a46682e706e67)
2. Unzip the ZIP file you just downloaded on your computer.
3. Open Chrome and enter the following URL in your tab bar: chrome://extensions/
This version of Cookie Glasses is not available on the Chrome Webstore of Firefox Addons, so it must be manually installed from source.

### Chrome / Chromium

1. Download & unpack the ZIP file for this repo (green `Code` button above > `Download ZIP`)
2. In the `Cookie-Glasses` directory, run `yarn run build`. This should produce a new `build` folder.
3. Open Chrome and visit the Chrome extensions settings: chrome://extensions/
4. Enable Developer mode in the top right.
5. Click "Load unpacked"
6. Choose the `Cookie-Glasse-master` folder on your computer.
7. Visit websites implementing the Transparency & Consent Framework
5. Choose "Load unpacked"
6. Choose the `build` folder generated in Step 2.
7. Visit websites implementing the Transparency & Consent Framework (note that you may need a VPN for some sites if you are not residing in the EU)
8. Enjoy detecting violations!

#### Firefox
### Firefox

On Firefox, out-of-store addons can only be loaded for the duration of the session (you will have to redo these steps if you close your browser).

1. Download the ZIP file of Cookie Glasses on your computer.
![Location of the zip file](https://camo.githubusercontent.com/71c8e3ec5ddbd2cac3b1d6469311f6bbf26c6465/68747470733a2f2f692e696d6775722e636f6d2f47784f6d6a46682e706e67)
2. Unzip the ZIP file you just downloaded on your computer.
3. Open Firefox and enter the following URL in your tab bar: about:debugging#/runtime/this-firefox
4. Click "Load temporary addon"
5. Choose the `manifest.json` file in the `Cookie-Glasse-master` folder on your computer.
6. Visit websites implementing the Transparency & Consent Framework
7. Enjoy detecting violations!
1. Download & unpack the ZIP file for this repo (green `Code` button above > `Download ZIP`)
3. In the `Cookie-Glasses` directory, run `yarn run build`. This should produce a new `build` folder.
4. Open Firefox and visit: about:debugging#/runtime/this-firefox
5. Click `Load Temporary Add-on...`
6. Choose any file in the `build` folder generated in Step 2.
7. Visit websites implementing the Transparency & Consent Framework (note that you may need a VPN for some sites if you are not residing in the EU)
8. Enjoy detecting violations!

## Limitations

As explained in the paper, there are two ways for advertisers to query the CMP:
1. through a direct call to the __cmp() function if they are in a first-party position,
2. through a postMessage sent to the __cmpLocator iframe if they are in a third-party position.
1. through a direct call to the __tcfapi() function if they are in a first-party position,
2. through a postMessage sent to the __tcfapiLocator (formerly known as __cmpLocator in v1) iframe if they are in a third-party position.

Because of the security mechanisms of browsers extensions, Cookie Glasses can only use the second method. According to our measurement, this method is working on 79% of websites using the TCF.

If you want to see consent on the remaining 21% of websites, here's a manual workaround:
1. Open the developer console (ctrl+maj+i)
2. Run the following code: `__cmp("getConsentData", null, function(v, success) { console.log(v); });`
3. If you obtain a response, copy-paste the string in the "consentData" field in Cookie Glasses' popup's "decode consent string" field and click on "decode".
2. Run the following snippet in the console of the webpage in question:
```__tcfapi("getTCData", 2, function(v, success) { console.log(v); });```
3. If you obtain a response, copy the string in the "tcString" field and decode it in the "Manually decode Consent String" section of the extension. You can find this section by clicking on the Tool icon at the bottom of the extension.

For now, the extension does not display the global shared cookie (which is a cookie storing consent, readable and writable by all CMPs of the framework).

## Run in developer mode
Follow the same instructions for both Chrome and Firefox as above, but instead of building the extension via `yarn build`, start the hot-reloading script with:
```
yarn run start
```

This will pick up any local changes made and automatically upload them to the unpacked extension in your browser.

## Privacy Policy
Cookie Glasses does not handle any personal information.
Cookie Glasses only processes consent information from IAB Europe's Transparency and Consent Framework (TCF) locally, and does not send any information to a distant server.
Binary file removed extension_popup.png
Binary file not shown.
Binary file removed extension_popup_640x400.png
Binary file not shown.
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "cookie-glasses",
"version": "1.0.0",
"description": "Cookie Glasses browser extension",
"scripts": {
"build": "node utils/build.js",
"start": "node utils/webserver.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/katie-ta/Cookie-Glasses.git"
},
"author": "Katie Ta, Charles Tan",
"license": "ISC",
"bugs": {
"url": "https://github.com/katie-ta/Cookie-Glasses/issues"
},
"homepage": "https://github.com/katie-ta/Cookie-Glasses#readme",
"devDependencies": {
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "6",
"css-loader": "3.2.0",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.24.2",
"file-loader": "4.3.0",
"fs-extra": "8.1.0",
"html-loader": "0.5.5",
"html-webpack-plugin": "3.2.0",
"style-loader": "1.0.0",
"webpack": "4.41.2",
"webpack-cli": "^4.9.0",
"webpack-dev-server": "3.9.0",
"write-file-webpack-plugin": "4.5.1"
},
"dependencies": {
"@iabtcf/core": "^1.3.1"
}
}
Binary file added screenshots/cookie-glasses-features.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/cookie-glasses-purposes.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/manual_decode_tcstring.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/no_cmp_found.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/unknown_cmp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/background.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>background</title>
</head>
<body>
</body>
</html>
Loading