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

GH-1989: Fixes site-specific whitelisting for unblocked trackers #522

Merged
merged 5 commits into from Apr 14, 2020
Merged
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -1,3 +1,8 @@
### GHOSTERY 8.5.0 ()

+ Fixes bug in site-specific tracker white-listing (Fixes #519)
+ Update legacy unit tests (#526)

### GHOSTERY 8.4.9 (April 9, 2019)

+ Better handling of semantic version comparison (#524)
@@ -3,10 +3,12 @@
"author": "Ghostery",
"name": "__MSG_name__",
"short_name": "Ghostery",
"version": "8.4.9",
"version_name": "8.4.9",
"version": "8.5.0",
"version_name": "8.5.0",
"default_locale": "en",
"description": "__MSG_short_description__",
"debug": true,
"log": true,
"icons": {
"16": "app/images/icon16.png",
"48": "app/images/icon48.png",
@@ -103,4 +105,4 @@
"cliqz/offers-reminder/index.html",
"cliqz/popup-notification/images/*"
]
}
}
@@ -43,72 +43,72 @@
},
"homepage": "https://github.com/ghostery/ghostery-extension#readme",
"dependencies": {
"@cliqz/adblocker-circumvention": "^1.5.0",
"@cliqz/url-parser": "^1.1.1",
"@cliqz/adblocker-circumvention": "^1.12.2",
"@cliqz/url-parser": "^1.1.3",
"browser-core": "https://github.com/cliqz-oss/browser-core/releases/download/v7.43.7/browser-core-7.43.7.tgz",
"classnames": "^2.2.5",
"d3": "^5.15.0",
"foundation-sites": "^6.6.1",
"d3": "^5.15.1",
"foundation-sites": "^6.6.2",
"history": "^4.10.1",
"json-api-normalizer": "^0.4.16",
"moment": "^2.19.1",
"prop-types": "^15.6.2",
"query-string": "^6.10.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"query-string": "^6.11.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-markdown": "^4.3.1",
"react-redux": "^7.1.3",
"react-redux": "^7.2.0",
"react-router-dom": "^5.1.2",
"react-svg": "^11.0.7",
"react-svg": "^11.0.15",
"redux": "^4.0.5",
"redux-object": "^0.5.10",
"redux-thunk": "^2.2.0",
"rsvp": "^4.8.5",
"spanan": "^2.0.0",
"ua-parser-js": "^0.7.21",
"underscore": "^1.9.2"
"underscore": "^1.10.2"
},
"devDependencies": {
"@babel/core": "^7.8.3",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-object-rest-spread": "^7.8.3",
"@babel/plugin-transform-modules-commonjs": "^7.8.3",
"@babel/preset-react": "^7.8.3",
"babel-eslint": "^10.0.3",
"babel-loader": "^8.0.6",
"@babel/plugin-proposal-object-rest-spread": "^7.9.0",
"@babel/plugin-transform-modules-commonjs": "^7.9.0",
"@babel/preset-react": "^7.9.4",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"clean-webpack-plugin": "^3.0.0",
"cross-env": "^7.0.0",
"cross-env": "^7.0.2",
"css-loader": "^3.4.2",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.0.1",
"eslint-loader": "^3.0.3",
"eslint-plugin-import": "^2.20.1",
"eslint-config-airbnb": "^18.1.0",
"eslint-loader": "^4.0.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.18.3",
"fs-extra": "^8.1.0",
"jest": "^25.1.0",
"eslint-plugin-react": "^7.19.0",
"fs-extra": "^9.0.0",
"jest": "^25.2.6",
"jest-fetch-mock": "^3.0.3",
"jest-when": "^2.7.0",
"jest-when": "^2.7.1",
"jsdoc": "^3.6.3",
"jsonfile": "^5.0.0",
"jsonfile": "^6.0.1",
"license-checker": "^25.0.1",
"mini-css-extract-plugin": "^0.9.0",
"node-sass": "^4.13.1",
"oboe": "^2.1.5",
"path": "^0.12.7",
"react-router": "^5.1.2",
"react-test-renderer": "^16.12.0",
"react-test-renderer": "^16.13.1",
"redux-mock-store": "^1.5.4",
"sass-loader": "^8.0.2",
"seamless-immutable": "^7.1.3",
"sinon-chrome": "^3.0.1",
"svg-url-loader": "^3.0.3",
"svg-url-loader": "^5.0.0",
"underscore-template-loader": "^1.0.0",
"url-loader": "^3.0.0",
"url-loader": "^4.0.0",
"vendor-copy": "^2.0.0",
"webpack": "^4.41.5",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"webpack-shell-plugin": "^0.5.0"
}
@@ -155,28 +155,46 @@ class Policy {
}

const allowedOnce = c2pDb.allowedOnce(tab_id, app_id);
// The app_id has been globally blocked
if (conf.selected_app_ids.hasOwnProperty(app_id)) {
// The app_id is on the site-specific allow list for this tab_host
if (conf.toggle_individual_trackers && conf.site_specific_unblocks.hasOwnProperty(tab_host) && conf.site_specific_unblocks[tab_host].includes(+app_id)) {
// Site blacklist overrides all block settings except C2P allow once
if (this.blacklisted(tab_url)) {
return { block: !allowedOnce, reason: allowedOnce ? BLOCK_REASON_C2P_ALLOWED_ONCE : BLOCK_REASON_BLACKLISTED };
}
return { block: false, reason: BLOCK_REASON_SS_UNBLOCKED };
}
// Check for site white-listing
if (this.checkSiteWhitelist(tab_url)) {
return { block: false, reason: BLOCK_REASON_WHITELISTED };
}
// The app_id is globally blocked
return { block: !allowedOnce, reason: allowedOnce ? BLOCK_REASON_C2P_ALLOWED_ONCE : BLOCK_REASON_GLOBAL_BLOCKED };
}
// We get here when app_id is not selected for global blocking

// The app_id has not been globally blocked
// Check to see if the app_id is on the site-specific block list for this tab_host
if (conf.toggle_individual_trackers && conf.site_specific_blocks.hasOwnProperty(tab_host) && conf.site_specific_blocks[tab_host].includes(+app_id)) {
// Site white-listing overrides blocking settings
if (this.checkSiteWhitelist(tab_url)) {
return { block: false, reason: BLOCK_REASON_WHITELISTED };
}
return { block: !allowedOnce, reason: allowedOnce ? BLOCK_REASON_C2P_ALLOWED_ONCE : BLOCK_REASON_SS_BLOCKED };
}
// Check to see if the app_id is on the site-specific allow list for this tab_host
if (conf.toggle_individual_trackers && conf.site_specific_unblocks.hasOwnProperty(tab_host) && conf.site_specific_unblocks[tab_host].includes(+app_id)) {
// Site blacklist overrides all block settings except C2P allow once
if (this.blacklisted(tab_url)) {
return { block: !allowedOnce, reason: allowedOnce ? BLOCK_REASON_C2P_ALLOWED_ONCE : BLOCK_REASON_BLACKLISTED };
}
return { block: false, reason: BLOCK_REASON_SS_UNBLOCKED };
}
// Check for site black-listing
if (this.blacklisted(tab_url)) {
return { block: !allowedOnce, reason: allowedOnce ? BLOCK_REASON_C2P_ALLOWED_ONCE : BLOCK_REASON_BLACKLISTED };
}
// The app_id is globally unblocked
return { block: false, reason: allowedOnce ? BLOCK_REASON_C2P_ALLOWED_ONCE : BLOCK_REASON_GLOBAL_UNBLOCKED };
}

ProTip! Use n and p to navigate between commits in a pull request.