Closed Bug 1901808 Opened 2 years ago Closed 2 years ago

Align content blocking flags from nsIWebProgressListener with ContentBlockingController

Categories

(GeckoView :: General, task, P2)

All
Android
task

Tracking

(firefox129 fixed)

RESOLVED FIXED
129 Branch
Tracking Status
firefox129 --- fixed

People

(Reporter: emz, Assigned: npoon)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [fxdroid][group4])

Attachments

(1 file)

Bug 1876736 adds STATE_PURGED_BOUNCETRACKER
Bug 1865707 added STATE_BLOCKED_SUSPICIOUS_FINGERPRINTING but didn't add it to GeckoView.

Severity: -- → S3
Priority: -- → P2

This would add android support for STATE_PURGED_BOUNCETRACKER (event for whenever we purge a bounce tracker, a security issue where third-party cookies are disabled) as well as STATE_BLOCKED_SUSPICIOUS_FINGERPRINTING. There’s more information in the patches from the privacy team.

Add these flags to the ContentBlockingController Events code link . Similar to the existing flags, they will be added to the LogEntry code link, BLOCKED_SUSPICIOUS_FINGERPRINTING would probably be added to the TrackingCategory.FINGERPRINTING (similar to BLOCKED_FINGERPRINTING_CONTENT).

We should look at Fenix code and see how tracking is propagated there. Also might not need any follow up in Fenix, depending on the answer to the below question. Otherwises, file another bug for that work. For additional context, here is a Fenix patch on exposing the Tracking categories.

Keywords: good-first-bug

Question for Paul or maybe Arturo: I'm not sure what category STATE_PURGED_BOUNCETRACKER would fall under. Here's the Tracking Categories that Android uses. What do you think?

Flags: needinfo?(amejiamarmol)

It doesn't really fit into either right now since those categories are for list based tracker blocking whereas bounce tracking protection uses heuristics to detect trackers and purges data periodically. it does not block trackers from loading or accessing cookies in the first place. Is it necessary to add it to those categories? What are they used for?

Flags: needinfo?(amejiamarmol) → needinfo?(calu)
Assignee: nobody → npoon
Whiteboard: [fxdroid][group4]

Thanks Paul for the info, they are used in the Android settings page to allow users to customize their tracking protection.

Nick, let's file a follow up to investigate how to propagate PURGED_BOUNCETRACKER to Fenix. I also see another category TrackingProtectionCategory (searchfox) as well that we should see where that is being used. What is the discrepancy between these categories and TrackingProtectionPolicy (searchfox).

Flags: needinfo?(calu)

Ultimatively we want to ship Bounce Tracking Protection enabled by default, it would only be disabled if the user disabled ETP entirely. As a next step we're shipping it to ETP "strict" (See Bug 1898717). It would be nice sync that up with Android so it gets enabled as part of "strict" there too.

I think by adding these flags to GeckoView, purging bounce trackers are included in the default ETP on Android. Do you know of a way to manually check bounced trackers are being purged?

Blocks: 1905075
Flags: needinfo?(pbz)
Pushed by calu@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/652466ab5720 Align content blocking flags from nslWebProgressListener with ContentBlockingController r=calu,geckoview-reviewers,android-reviewers,owlish
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch

Here is how you can trigger the protection:

  1. go to about:config and ensure privacy.bounceTrackingProtection.enabled=true is set. Set privacy.bounceTrackingProtection.bounceTrackingGracePeriodSec=0
  2. Visit https://bounce-tracking-demo.glitch.me/ and click on one of the bounce links
  3. After the browser navigated click on one of the bounce links again
  4. In the browser console execute the following code:
XPCOMUtils.defineLazyServiceGetter(
  this,
  "bounceTrackingProtection",
  "@mozilla.org/bounce-tracking-protection;1",
  "nsIBounceTrackingProtection"
);
await bounceTrackingProtection.testRunPurgeBounceTrackers();

It should give you an non-empty array of bounce trackers purged. At this point the purged trackers should have been reported via the ContentBlockingLog and they should show up in ETP tracker statistics for total trackers blocked.

Hope that answers your question!

Flags: needinfo?(pbz)

Thanks Paul!

I tried on desktop just to see and I'm getting the following error:

XPCOMUtils.defineLazyServiceGetter(
  this,
  "bounceTrackingProtection",
  "@mozilla.org/bounce-tracking-protection;1",
  "nsIBounceTrackingProtection"
);
await bounceTrackingProtection.testRunPurgeBounceTrackers();

Uncaught (in promise) NS_ERROR_XPC_GS_RETURNED_FAILURE: ServiceManager::GetService returned failure code:
    defineLazyServiceGetter resource://gre/modules/XPCOMUtils.sys.mjs:140
    <anonymous> debugger eval code:3
    <anonymous> debugger eval code:4
    getEvalResult resource://devtools/server/actors/webconsole/eval-with-debugger.js:306
    evalWithDebugger resource://devtools/server/actors/webconsole/eval-with-debugger.js:218
    evaluateJS resource://devtools/server/actors/webconsole.js:953
    evaluateJSAsync resource://devtools/server/actors/webconsole.js:846
    makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:103
XPCOMUtils.sys.mjs:140
    defineLazyServiceGetter resource://gre/modules/XPCOMUtils.sys.mjs:140
    <anonymous> debugger eval code:3
    <anonymous> debugger eval code:4
    getEvalResult resource://devtools/server/actors/webconsole/eval-with-debugger.js:306
    evalWithDebugger resource://devtools/server/actors/webconsole/eval-with-debugger.js:218
    evaluateJS resource://devtools/server/actors/webconsole.js:953
    evaluateJSAsync resource://devtools/server/actors/webconsole.js:846
    makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:103
Flags: needinfo?(pbz)

Did you test this on Nightly? Please also double check that you set the prefs from comment 10. It's odd because the exact same command works on my machine.

I'm also curious if getting the service like this will give us a more meaningful error code:

let bounceTrackingProtection = Cc["@mozilla.org/bounce-tracking-protection;1"]
                          .getService(Ci.nsIBounceTrackingProtection);
Flags: needinfo?(pbz) → needinfo?(calu)

Thanks for the quick response, I wasn't on the latest Nightly. I see Array [ "bounce-tracking-demo-tracker-server.glitch.me" ] now, and will check on mobile.

Flags: needinfo?(calu)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: