Closed Bug 1593083 Opened 5 years ago Closed 5 years ago

Tracking channels are improperly classified as non-tracking in the child process

Categories

(Core :: Privacy: Anti-Tracking, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox-esr68 --- unaffected
firefox71 --- wontfix
firefox72 --- fixed

People

(Reporter: englehardt, Assigned: xeonchen)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

STR:

  1. On Nightly, go to https://www.lemonde.fr/ and open up the devtools network panel
  2. Scroll down the page a bit to trigger the loading of third parties
  3. Filter network panel to adnxs.com

Expected: All adnxs.com resources have cookies stripped
Actual: Only some adnxs.com resources have cookies stripped.

I started digging into the cause and I believe it's related to a mismatch in the channel classification flags between the parent and child channels. In the parent process, the resources are classified as expected:

[Parent 24613: URL Classifier]: D/UrlClassifierDbService Checking table ads-track-digest256, URL is ib.adnxs.com/ut/v3/prebid
[Parent 24613: URL Classifier]: D/UrlClassifierDbService Found a result in fragment adnxs.com/, hash EE75F998B5C372274469BA10C15D55272633342053B6403CD62B8408C5D8E45A (98F975EE)
[Parent 24613: URL Classifier]: D/UrlClassifierDbService Result confirmed., match 32-bytes prefix
[Parent 24613: URL Classifier]: D/UrlClassifierDbService Found 1 results.
[Parent 24613: URL Classifier]: I/nsChannelClassifier TableData::DoLookup[0x7f77a88f3790] - lookup completed. Matches: 1
[Parent 24613: URL Classifier]: I/nsChannelClassifier FeatureData::DoLookup[0x7f77aa9b4348] - blacklisted before whitelisting: 1
[Parent 24613: URL Classifier]: I/nsChannelClassifier TableData::DoLookup[0x7f77a75ca9a0] - starting lookup
[Parent 24613: URL Classifier]: D/UrlClassifierDbService Checking table mozstd-trackwhite-digest256, URL is www.lemonde.fr/?resource=adnxs.com
[Parent 24613: URL Classifier]: D/UrlClassifierDbService Found 0 results.
[Parent 24613: URL Classifier]: I/nsChannelClassifier TableData::DoLookup[0x7f77a75ca9a0] - lookup completed. Matches: 0
[Parent 24613: URL Classifier]: I/nsChannelClassifier TableData::DoLookup[0x7f77a88f3d90] - starting lookup
[Parent 24613: URL Classifier]: D/UrlClassifierDbService Checking table moztest-trackwhite-simple, URL is www.lemonde.fr/?resource=adnxs.com
[Parent 24613: URL Classifier]: D/UrlClassifierDbService Found 0 results.
[Parent 24613: URL Classifier]: I/nsChannelClassifier TableData::DoLookup[0x7f77a88f3d90] - lookup completed. Matches: 0
[Parent 24613: URL Classifier]: I/nsChannelClassifier FeatureData::DoLookup[0x7f77aa9b4348] - blacklisted
[Parent 24613: URL Classifier]: I/nsChannelClassifier FeatureTask::DoLookup[0x7f77a74ead00] - lookup completed
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b4208] - completing classification for channel 0x7f77aa9ed040
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b4208] - no match. Let's move on
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b4248] - completing classification for channel 0x7f77aa9ed040
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b4248] - no match. Let's move on
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b4288] - completing classification for channel 0x7f77aa9ed040
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b4288] - no match. Let's move on
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b42c8] - completing classification for channel 0x7f77aa9ed040
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b42c8] - no match. Let's move on
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b4308] - completing classification for channel 0x7f77aa9ed040
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b4308] - no match. Let's move on
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b4348] - completing classification for channel 0x7f77aa9ed040
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b4348] - blacklisted
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureData::MaybeCompleteClassification[0x7f77aa9b4348] - process channel 0x7f77aa9ed040
[Parent 24613: Main Thread]: D/thirdPartyUtil ThirdPartyUtil::IsThirdPartyChannel [channel=0x7f77aa9ed040]
[Parent 24613: Main Thread]: D/thirdPartyUtil ThirdPartyUtil::IsThirdPartyInternal lemonde.fr =? adnxs.com
[Parent 24613: Main Thread]: D/thirdPartyUtil ThirdPartyUtil::IsThirdPartyInternal adnxs.com =? lemonde.fr
[Parent 24613: Main Thread]: I/nsChannelClassifier UrlClassifierCommon::AnnotateChannel, annotating channel[0x7f77aa9ed040]
[Parent 24613: Main Thread]: I/nsChannelClassifier FeatureTask::CompleteClassification[0x7f77a74ead00] - exec callback

However, in the child process the channel for this URI appears to no longer have the classification flag:

[Child 24900: Main Thread]: D/AntiTracking Computing whether channel 0x7f99fc8a9070 has access to URI https://ib.adnxs.com/ut/v3/prebid
[Child 24900: Main Thread]: D/AntiTracking Deciding whether the user has overridden content blocking for https://www.lemonde.fr/
[Child 24900: Main Thread]: D/AntiTracking No user override found
[Child 24900: Main Thread]: D/thirdPartyUtil ThirdPartyUtil::IsThirdPartyChannel [channel=0x7f99fc8a9070]
[Child 24900: Main Thread]: D/thirdPartyUtil ThirdPartyUtil::IsThirdPartyInternal lemonde.fr =? adnxs.com
[Child 24900: Main Thread]: D/AntiTracking Our channel isn't a third-party tracking channel

That last message is the result of the check here: https://searchfox.org/mozilla-central/rev/ce02064d8afc8673cef83c92896ee873bd35e7ae/toolkit/components/antitracking/AntiTrackingCommon.cpp#1692-1694

Assignee: nobody → xeonchen

Gary, please add a good explanation of your patch, the cause of the bug etc... Thanks.

Flags: needinfo?(xeonchen)

(In reply to Honza Bambas (:mayhemer) from comment #2)

Gary, please add a good explanation of your patch, the cause of the bug etc... Thanks.

Just added, sorry for not having a good description of that.

Flags: needinfo?(xeonchen)

Bug 1516309 is an existing bug which is related to the classification flags being accessed before a classification is done on the post-redirect channel... I wonder if you're seeing something similar here, in case it helps.

I think this could be an intermittent bug.

Yesterday :englehardt told me it was good, so I use mozregression today to find out regression build.
But I can't find the exact revision because the result doesn't make any sense.

Here's what I found:

  1. It can be good on today's (2019-11-13) build.
  2. Usually there are only connections to ib.adnxs.com, and this is almost good except on some reload case.
  3. Except case 2, if something get unclassified, it's <country>-ib.adnxs.com, in my case <country> is ams1 and in the bug description, it is lax1. But connection to this host doesn't always happen.

Bugbug thinks this bug is a regression, but please revert this change in case of error.

Keywords: regression

(In reply to Gary Chen [:xeonchen] from comment #5)

I think this could be an intermittent bug.

Yesterday :englehardt told me it was good, so I use mozregression today to find out regression build.
But I can't find the exact revision because the result doesn't make any sense.

Here's what I found:

  1. It can be good on today's (2019-11-13) build.
  2. Usually there are only connections to ib.adnxs.com, and this is almost good except on some reload case.
  3. Except case 2, if something get unclassified, it's <country>-ib.adnxs.com, in my case <country> is ams1 and in the bug description, it is lax1. But connection to this host doesn't always happen.

The intermittency is probably the result of different things coming down the network, no? It may be a good idea to use a record and replay proxy (like mitmproxy) to record a version of the page that reproduces the bug and then use mozregression on the recording...

It looks like UrlClassifierCommon::ShouldEnableClassifier returns false because it is called in parent process, where GetTopWindowURI is invalid.

By setting pref dom.serviceWorkers.parent_intercept to false, will seem to fix this because the above checking will be done in child process.
The pref is enabled in bug 1456995.

Steven, could you help to test if the pref fixes the issue on your platform?

Flags: needinfo?(senglehardt)

Yes, setting that pref to false fixes the issue for me. Good find!

Flags: needinfo?(senglehardt)

(In reply to Steven Englehardt [:englehardt] from comment #9)

Yes, setting that pref to false fixes the issue for me. Good find!

Thanks. I think this is probably regressed by bug 1456995, where ServiceWorker interception was moved from child to parent process, therefore a classification is not possible.

Perry and Dimi, any idea?

Flags: needinfo?(perry)
Flags: needinfo?(dlee)
Regressed by: 1456995

(In reply to Gary Chen [:xeonchen] from comment #8)

It looks like UrlClassifierCommon::ShouldEnableClassifier returns false because it is called in parent process, where GetTopWindowURI is invalid.

This is because Bug 1437626

After talking with Gary, we think Bug 1437626 may NOT help fix this issue(Although that is still something we need to fix).
As gary explained to me, the flow here is:

  1. visit channel tracker.com
  2. channel tracker.com is intercepted by ServiceWorker
  3. SW decides not to intercept this channel and redirects it back to the original channel tracker.com

In step 1, tracker.com is annotated as a tracker no matter dom.serviceWorkers.parent_intercept is on or off
In step 2, intercepted tracker.com is NOT annotated as a tracker no matter dom.serviceWorkers.parent_intercept is on or off (Because of Bug 1437626)
In Step 3. tracker.com is annotated as a tracker when the pref is off and is NOT annotated as a a tracker when the pref is on.

This bug relies on step3 to annotate channels properly, we need to figure out what's the difference between the pref is on and the pref is off in step3. gary, please correct me if anything is wrong here, thx

Flags: needinfo?(dlee)

Considering the impact, this bug should be a top priority.

Priority: -- → P1

It sounds like the fix here is to fix bug 1437626.

Clearing ni? because it looks like the underlying bug is identified.

Flags: needinfo?(perry)
Attachment #9107210 - Attachment description: Bug 1593083 - copy classified flags when channel is redirected; → Bug 1593083 - Ensure mTopWindowURI & mContentBlockingAllowListPrincipal are set correctly during HTTP redirects;

Just updated the patch. Copying mTopWindowURI while redirecting to InterceptedHttpChannel will make UrlClassifier work again.
I think fixing bug 1437626 may potentially fix this bug.

See Also: → 1437626
Pushed by xeonchen@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/7f37a007a205
Ensure mTopWindowURI & mContentBlockingAllowListPrincipal are set correctly during HTTP redirects; r=mayhemer,Ehsan
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: