Skip to content

Commit 14362a6

Browse files
authored
Merge pull request #215 from artines1/PR_CMP
Add the ConsentManager category
2 parents f2d12cd + 9ebafb3 commit 14362a6

7 files changed

+58
-17
lines changed

constants.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@
5555
# email trackers added in 2022
5656
"tracking-protection-email-content",
5757
"tracking-protection-email-base",
58+
# consent manager trackers added in 2025
59+
"tracking-protection-consent-manager",
5860
)
59-
DNT_EMAIL_SECTIONS = (
60-
"tracking-protection-email-content",
61-
"tracking-protection-email-base",
62-
)
61+
6362
DNT_CONTENT_SECTIONS = (
6463
"tracking-protection-content",
6564
"tracking-protection-contenteff",
@@ -104,7 +103,6 @@
104103
]
105104

106105
VERS_LARGE_ENTITIES_SEPARATION_STARTED = 74
107-
VERSION_EMAIL_CATEGORY_INTRODUCED = 97
108106

109107
WEBKIT_LISTS_DIR = 'webkit-lists'
110108
WEBKIT_BLOCK_ALL = "block"

lists2safebrowsing.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,21 @@
1313
from publicsuffixlist.update import updatePSL
1414

1515
from constants import (
16-
DNT_EMAIL_SECTIONS,
1716
DNT_SECTIONS,
1817
PLUGIN_SECTIONS,
1918
PRE_DNT_SECTIONS,
2019
LARGE_ENTITIES_SECTIONS,
2120
STANDARD_ENTITY_SECTION,
2221
TEST_DOMAIN_TEMPLATE,
23-
VERSION_EMAIL_CATEGORY_INTRODUCED,
2422
VERS_LARGE_ENTITIES_SEPARATION_STARTED,
2523
ENTITYLIST_SECTIONS
2624
)
2725

2826
from utils import (
2927
get_blocked_domains,
3028
add_domain_to_list,
31-
load_json_from_url
29+
load_json_from_url,
30+
should_skip_section_for_version,
3231
)
3332

3433
from publish2cloud import (
@@ -442,10 +441,8 @@ def get_versioned_lists(config, chunknum, version):
442441
version_configurations(config, section, version)
443442
ver = p_version.parse(version)
444443
if (section in PRE_DNT_SECTIONS or section in DNT_SECTIONS):
445-
skip_section = (
446-
section in DNT_EMAIL_SECTIONS
447-
and ver.release[0] < VERSION_EMAIL_CATEGORY_INTRODUCED
448-
)
444+
skip_section = should_skip_section_for_version(config, section, ver.release[0])
445+
449446
if skip_section:
450447
# import ipdb; ipdb.set_trace()
451448
continue

publish2cloud.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
shared_state
3434
)
3535

36+
from utils import should_skip_section_for_version
37+
3638
from kinto_http import Client, BearerTokenAuth, KintoException
3739

3840
try:
@@ -170,7 +172,7 @@ def new_data_to_publish_to_remote_settings(config, section, new, version=None):
170172
# Check to see if update is needed on Remote Settings
171173
record = get_record_remote_settings(record_name)
172174

173-
if version is None:
175+
if version is None and record:
174176
# We need to check if the filter_expression needs to be updated for the
175177
# nightly records. The filter_expression needs to be updated if the
176178
# latest supported version has changed
@@ -356,6 +358,11 @@ def publish_to_cloud(config, chunknum, check_versioning=None):
356358
continue
357359

358360
version = p_version.parse(config.get(section, 'version'))
361+
skip_section = should_skip_section_for_version(config, section, version.release[0])
362+
363+
if skip_section:
364+
continue
365+
359366
skip_large_entity_separation = (
360367
version.release[0] < VERS_LARGE_ENTITIES_SEPARATION_STARTED
361368
and section in LARGE_ENTITIES_SECTIONS

rs_dev.ini

+9-1
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,16 @@ versioning_needed=true
185185
categories=Email
186186
output=base-email-track-digest256
187187
versioning_needed=true
188+
min_supported_version=97
188189

189190
[tracking-protection-email-content]
190191
categories=EmailAggressive
191192
output=content-email-track-digest256
192-
versioning_needed=true
193+
versioning_needed=true
194+
min_supported_version=97
195+
196+
[tracking-protection-consent-manager]
197+
categories=ConsentManagers
198+
output=consent-manager-track-digest256
199+
versioning_needed=true
200+
min_supported_version=137

rs_prod.ini

+9-1
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,16 @@ versioning_needed=true
185185
categories=Email
186186
output=base-email-track-digest256
187187
versioning_needed=true
188+
min_supported_version=97
188189

189190
[tracking-protection-email-content]
190191
categories=EmailAggressive
191192
output=content-email-track-digest256
192-
versioning_needed=true
193+
versioning_needed=true
194+
min_supported_version=97
195+
196+
[tracking-protection-consent-manager]
197+
categories=ConsentManagers
198+
output=consent-manager-track-digest256
199+
versioning_needed=true
200+
min_supported_version=137

rs_stage.ini

+9-1
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,16 @@ versioning_needed=true
185185
categories=Email
186186
output=base-email-track-digest256
187187
versioning_needed=true
188+
min_supported_version=97
188189

189190
[tracking-protection-email-content]
190191
categories=EmailAggressive
191192
output=content-email-track-digest256
192-
versioning_needed=true
193+
versioning_needed=true
194+
min_supported_version=97
195+
196+
[tracking-protection-consent-manager]
197+
categories=ConsentManagers
198+
output=consent-manager-track-digest256
199+
versioning_needed=true
200+
min_supported_version=137

utils.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from trackingprotection_tools import DisconnectParser
66
import sys
77
import json
8+
from packaging import version as p_version
89
from publicsuffixlist import PublicSuffixList
910
from publicsuffixlist.update import updatePSL
1011
from urllib.request import urlopen
@@ -198,4 +199,18 @@ def get_domains_from_filters(parser, category_filters,
198199
print(" * found %d rule(s) with filter %s. Filtered output to %d." %
199200
(len(result), tag_filters, len(output)))
200201

201-
return output
202+
return output
203+
204+
def should_skip_section_for_version(config, section, version):
205+
"""
206+
Checks if the section should be skipped for the given version.
207+
"""
208+
skip_section = False
209+
210+
min_supported_version = (config.has_option(section, 'min_supported_version')
211+
and p_version.parse(config.get(section, 'min_supported_version')))
212+
213+
if min_supported_version and version < min_supported_version.release[0]:
214+
skip_section = True
215+
216+
return skip_section

0 commit comments

Comments
 (0)