Skip to content

Commit

Permalink
Match feature state to feature table (#79)
Browse files Browse the repository at this point in the history
* Match feature state to feature table

* Remove state keys

* Fix auto consent

* Branch updates

* Fix legacy generation

* Update gh action node version
  • Loading branch information
SlayterDev authored Dec 13, 2021
1 parent f0dea46 commit 048762b
Show file tree
Hide file tree
Showing 20 changed files with 133 additions and 68 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ description: 'Build generated privacy configs'
author: DuckDuckGo

runs:
using: 'node12'
using: 'node16'
main: 'index.js'
31 changes: 31 additions & 0 deletions features/amp-links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"_meta": {
"description": "Rewrite AMP links to safer alternatives.",
"sampleExcludeRecords": {
"domain": "example.com",
"reason": "site breakage"
}
},
"exceptions": [],
"settings": {
"ampLinkFormats": [
"^https?:\\/\\/(?:w{3}\\.)?google\\.\\S{2,}\\/amp\\/s\\/(\\S+)$",
"^https?:\\/\\/\\S+ampproject\\.org\\/v\\/s\\/(\\S+)$"
],
"ampKeywords": [
"=amp",
"amp=",
"&amp",
"amp&",
"/amp",
"amp/",
".amp",
"amp.",
"%amp",
"amp%",
"_amp",
"amp_",
"?amp"
]
}
}
1 change: 0 additions & 1 deletion features/autoconsent.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"reason": "site breakage"
}
},
"state": "enabled",
"exceptions": [{
"domain": "spiegel.de",
"reason": "Opt-out not possible"
Expand Down
1 change: 0 additions & 1 deletion features/click-to-play.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"reason": "site breakage"
}
},
"state": "enabled",
"exceptions": []
}
1 change: 0 additions & 1 deletion features/fingerprinting-battery.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"reason": "site breakage"
}
},
"state": "enabled",
"exceptions": []
}
1 change: 0 additions & 1 deletion features/fingerprinting-canvas.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"reason": "site breakage"
}
},
"state": "enabled",
"exceptions": [
{
"domain": "walgreens.com",
Expand Down
1 change: 0 additions & 1 deletion features/fingerprinting-hardware.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"reason": "site breakage"
}
},
"state": "enabled",
"exceptions": [
{
"domain": "play.geforcenow.com",
Expand Down
1 change: 0 additions & 1 deletion features/fingerprinting-screen-size.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"reason": "site breakage"
}
},
"state": "enabled",
"exceptions": []
}
1 change: 0 additions & 1 deletion features/fingerprinting-temporary-storage.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"reason": "site breakage"
}
},
"state": "enabled",
"exceptions": []
}
1 change: 0 additions & 1 deletion features/floc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"reason": "site breakage"
}
},
"state": "enabled",
"exceptions": []
}
10 changes: 10 additions & 0 deletions features/navigator-credentials.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"_meta": {
"description": "Disable the credentials API on the navigator",
"sampleExcludeRecords": {
"domain": "example.com",
"reason": "site breakage"
}
},
"exceptions": []
}
1 change: 0 additions & 1 deletion features/referrer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"reason": "site breakage"
}
},
"state": "enabled",
"exceptions": []
}
1 change: 0 additions & 1 deletion features/tracking-cookies-1p.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"reason": "site breakage"
}
},
"state": "enabled",
"settings": {
"firstPartyTrackerCookiePolicy": {
"threshold": 86400,
Expand Down
1 change: 0 additions & 1 deletion features/tracking-cookies-3p.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"reason": "site breakage"
}
},
"state": "enabled",
"settings": {
"excludedCookieDomains": [
{
Expand Down
35 changes: 35 additions & 0 deletions features/tracking-parameters.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"_meta": {
"description": "Rewrite links with tracking parameters to safer alternatives.",
"sampleExcludeRecords": {
"domain": "example.com",
"reason": "site breakage"
}
},
"exceptions": [],
"settings": {
"trackingParameters": [
"utm_[a-zA-Z]*",
"gclid",
"fbclid",
"fb_action_ids",
"fb_action_types",
"fb_source",
"fb_ref",
"ga_source",
"ga_medium",
"ga_term",
"ga_content",
"ga_campaign",
"ga_place",
"action_object_map",
"action_type_map",
"action_ref_map",
"gs_l",
"mkt_tok",
"hmb_campaign",
"hmb_source",
"hmb_medium"
]
}
}
1 change: 0 additions & 1 deletion features/user-agent-rotation.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"reason": "Two factor auth that verifies device pathes using user agent"
}
},
"state": "disabled",
"settings": {
"agentExcludePatterns": [
{
Expand Down
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,18 @@ const legacyNaming = {
const protections = {}
for (const key in legacyNaming) {
let newConfig
const override = JSON.parse(fs.readFileSync(`${OVERRIDE_DIR}/extension-override.json`))
if (!defaultConfig.features[key] || defaultConfig.features[key].state !== 'enabled') {
const override = JSON.parse(fs.readFileSync(`${OVERRIDE_DIR}/extension-override.json`))
if (!override.features[key]) {
continue
}

newConfig = override.features[key]
if (!newConfig.exceptions) {
// feature may be disabled in default config but enabled in override
// add exceptions from default config
newConfig.exceptions = defaultConfig.features[key]?.exceptions || []
}

// TODO: convert camel key to hyphen
if (fs.existsSync(`${LISTS_DIR}/${key}.json`)) {
Expand All @@ -152,6 +157,7 @@ for (const key in legacyNaming) {
}
} else {
newConfig = defaultConfig.features[key]
newConfig.exceptions = newConfig.exceptions.concat(override.features[key]?.exceptions || [])
}
const legacyConfig = {
enabled: newConfig.state === 'enabled',
Expand Down
36 changes: 34 additions & 2 deletions overrides/extension-override.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
{
"features": {
"autofill": {
"state": "enabled",
"exceptions": []
"state": "enabled"
},
"referrer": {
"state": "enabled"
},
"clickToPlay": {
"state": "enabled"
},
"trackingCookies3p": {
"state": "enabled"
},
"trackingCookies1p": {
"state": "enabled"
},
"fingerprintingCanvas": {
"state": "enabled"
},
"fingerprintingAudio": {
"state": "disabled"
},
"fingerprintingTemporaryStorage": {
"state": "enabled"
},
"fingerprintingScreenSize": {
"state": "enabled"
},
"fingerprintingHardware": {
"state": "enabled"
},
"fingerprintingBattery": {
"state": "enabled"
},
"floc": {
"state": "enabled"
}
},
"unprotectedTemporary": [
Expand Down
61 changes: 11 additions & 50 deletions overrides/ios-override.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
}
]
},
"fingerprintingTemporaryStorage": {
"state": "enabled"
},
"fingerprintingScreenSize": {
"state": "enabled"
},
"fingerprintingBattery": {
"state": "enabled"
},
"gpc": {
"settings": {
"gpcHeaderEnabledSites": [
Expand All @@ -19,58 +28,10 @@
}
},
"ampLinks": {
"state": "enabled",
"exceptions": [],
"settings": {
"linkFormats": [
"^https?:\\/\\/(?:w{3}\\.)?google\\.\\S{2,}\\/amp\\/s\\/(\\S+)$",
"^https?:\\/\\/\\S+ampproject\\.org\\/v\\/s\\/(\\S+)$"
],
"keywords": [
"=amp",
"amp=",
"&amp",
"amp&",
"/amp",
"amp/",
".amp",
"amp.",
"%amp",
"amp%",
"_amp",
"amp_",
"?amp"
]
}
"state": "enabled"
},
"trackingParameters": {
"state": "enabled",
"exceptions": [],
"settings": {
"parameters": [
"utm_[a-zA-Z]*",
"gclid",
"fbclid",
"fb_action_ids",
"fb_action_types",
"fb_source",
"fb_ref",
"ga_source",
"ga_medium",
"ga_term",
"ga_content",
"ga_campaign",
"ga_place",
"action_object_map",
"action_type_map",
"action_ref_map",
"gs_l",
"mkt_tok",
"hmb_campaign",
"hmb_source",
"hmb_medium"
]
}
"state": "enabled"
}
},
"unprotectedTemporary": [
Expand Down
6 changes: 4 additions & 2 deletions overrides/macos-override.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"features": {
"navigatorCredentials": {
"state": "enabled",
"exceptions": []
"state": "enabled"
},
"autoconsent": {
"state": "enabled"
},
"gpc": {
"settings": {
Expand Down

0 comments on commit 048762b

Please sign in to comment.