Open Bug 1523389 Opened 6 years ago Updated 3 years ago

Tracking Protection stats: domain whitelist will falsely match domains (actual content blocker is ok)

Categories

(Firefox for iOS :: General, enhancement, P3)

Other
iOS
enhancement

Tracking

()

Tracking Status
fxios 16.0 ---

People

(Reporter: garvan, Unassigned)

Details

The whitelisting for tracking protection turns domains such as "example.com" into "*.example.com$", which would incorrectly match "badexample.com".

Priority: -- → P1

This comment makes a good point, https://github.com/mozilla-mobile/firefox-ios/pull/4499#discussion_r251568777,
which is that the input domains are not formatted as just <domainname>, rather they always are *<domainname> in the wildcard input format, which is transformed to a regex with a prefix of \.* (period literal, repeated zero or more times).

  1. The code should guard against non-wildcard domains being passed in to wildcardContentBlockerDomainToRegex()

  2. Whitelisting logic looks questionable, the code should not be substring matching the whitelisted domain. The url.baseDomain (ETLD+1) is what is used to match against the whitelisted domains, so the whitelisted domains could just store ETLD+1, and the match could be a string equality check.

Priority: P1 → P2

The bug is not in the content blocker, which formats whitelist domains as:
"if-domain": ["*domain"]

According to docs this is fine:

Add * in front to match domain and subdomains.
from https://developer.apple.com/documentation/safariservices/creating_a_content_blocker

The bug is only in the stats reporting, so this is a minor issue.

Summary: Tracking Protection domain whitelist will falsely match domains → Tracking Protection stats: domain whitelist will falsely match domains (actual content blocker is ok)
Priority: P2 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.