Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blocking by uBlock Origin not detected #53

Closed
ne20002 opened this issue Mar 5, 2023 · 15 comments
Closed

blocking by uBlock Origin not detected #53

ne20002 opened this issue Mar 5, 2023 · 15 comments
Labels
bug Something isn't working

Comments

@ne20002
Copy link

ne20002 commented Mar 5, 2023

I wondered how to get a 100% blocking, as I always had a few entries stated as not blocked. I took some tests and it showed that blocking with uBlock Origin in Firefox (desktop and Android) is not detected (correctly).

Add all urls or the given blocklist to local pi-hole. Disable uBlock Origin.
-> 100% of URLs are blocked, but scripts and static/dynamic ads is red

Enable uBlock Origin, still with blocking in pi-hole.
-> scripts and static/dynamic ad is schown as blocked (green) but a few URLs which are blocked by uBlock Origin are shown as red. Even though they are blocked by pi-hole also: (ads.youtube.com, ads-api.twitter.com)

Looking in console of Firefox desktop, these two urls are not called but shown as red anyway.

@d3ward d3ward added the bug Something isn't working label Mar 5, 2023
@d3ward
Copy link
Owner

d3ward commented Mar 10, 2023

First of all , there is no need to do a 100% , this is not like a competition or something . It's just a tool that check if you are blocking something or not .
For hosts part you should be able to block all by using a direct host list like https://raw.githubusercontent.com/d3ward/toolz/master/src/d3host.adblock or lists like OISD which include my own list
For static/dynamic ads , uBo is enough , you just need to make sure to not have conflict list like Easylist + Fanboy lists have issues together, I think that this one is uBo bug mostly , here my configuration of Filter list on ublock

Built-in (6/6) :All
Ads (3/3) : All
Privacy (3/3) : All
Malware domains (3/3) : All
Annoyances (3/7) :
- AdGuard Annoyances 
- AdGuard Social Media
- EasyList Cookie 
Multipurpose (1/2) : Peter Lowe’s Ad and tracking server list 
Custom : d3Host List by d3ward + any other list you like 

With above configuration , uBo is expected to also block the scripts loading too , and the tools should detect a 100%.

@Porkepix
Copy link

First of all , there is no need to do a 100% , this is not like a competition or something . It's just a tool that check if you are blocking something or not . For hosts part you should be able to block all by using a direct host list like master/src/d3host.adblock (raw) or lists like OISD which include my own list For static/dynamic ads , uBo is enough , you just need to make sure to not have conflict list like Easylist + Fanboy lists have issues together, I think that this one is uBo bug mostly , here my configuration of Filter list on ublock

Built-in (6/6) :All
Ads (3/3) : All
Privacy (3/3) : All
Malware domains (3/3) : All
Annoyances (3/7) :
- AdGuard Annoyances 
- AdGuard Social Media
- EasyList Cookie 
Multipurpose (1/2) : Peter Lowe’s Ad and tracking server list 
Custom : d3Host List by d3ward + any other list you like 

With above configuration , uBo is expected to also block the scripts loading too , and the tools should detect a 100%.

Found out this issue similar to what I've seen when someone showed your tool a couple of days ago.

So that I understand, if the issue doesn't even leave the browser, it should be considered as fine?

I'll explain what's strange here:
Setup is uBo with all the filters you listed (excepted your own), and also uMatrix on top of that.
Reached score is 93% (first one, strangely, was 90%, but after a single retry without changing anything, it went up to 93% and never moved from that).

I've scoured both uMatrix matrix and Firefox' devtools.
The only requests to get through are:

  • adblock.html
  • adblock.css
  • adblock.js
  • two different icon.svg

All of them are coming from the domain hosting the tool.
From the 10 domains marked as red and claimed as not blocked, one particularly stands out: doubleclick where every line in here is red, marking the whole block as red (the 5 others are isolated ones).
Not a single request to doubleclick was event sent by the browser according to devtools, it doesn't even appears as a red blocked line. Considering that, why would it show as red?

Note that it's the same for the whole 10 ones appearing as red: they're all missing from devtools network logs, as opposed to those in green, appearing in the devtools but marked as blocked.

@ne20002
Copy link
Author

ne20002 commented Mar 10, 2023

Sure. I opened the issue as I'm sure that in both cases all urls are blocked and that the test showing some as not blocked is wrong.
But I'm not sure what the return codes of unlock is. Looking in the code, I'm not expert here, seems as if it checks on http status code. I wonder how it is handled if the domain lookup is returning nxdomain or 0.0.0.0.

@d3ward
Copy link
Owner

d3ward commented Mar 10, 2023

@Porkepix yeah , weird things going on sometimes . So I got able to replicate your issue or similar i'd say
image
Looking at this . I'm 100% sure that everything is blocked , so the test works and provide a 100%. But looking on the devtool logs on network tabs , something goes on . Every browser have different ways of doing thing and every adblock solutions works different too .

@d3ward
Copy link
Owner

d3ward commented Mar 10, 2023

@ne20002 So, JS is pretty limited + CORS thing didn't help. My solution code is pretty simple, I make a HEAD request to this host (Why HEAD and not GET?). To avoid loading the real content of those urls like ads, trackers etc.). ) . From there in case of ublock if the request is blocked it will return a net::ERR_BLOCKED_BY_CLIENT so that means it's blocked.
Pretty straightforward. Issue is that every browser handles the issue differently and every adblock solution does things in it's own way, like DNS they block and return the same error as ublock, others just redirect the page to a blocking page. Plus some hosts sometimes depending on internet speed, or even device performance, the test might have some false negative results.
The test is supposed to work with most standard solutions, and must be done with one solution at a time. I tried my best to improve and make the detection even better than before, also included a compatibility table ( you can check that on top of the test page ) to make everyone aware of the limitations.

@Porkepix
Copy link

@Porkepix yeah , weird things going on sometimes . So I got able to replicate your issue or similar i'd say image Looking at this . I'm 100% sure that everything is blocked , so the test works and provide a 100%. But looking on the devtool logs on network tabs , something goes on . Every browser have different ways of doing thing and every adblock solutions works different too .

I'm not sure what do you mean by reproducing with this screenshot?
I thought at first the 307 would be the issues here looking at the doubleclick ones, but one of those is correctly shown as blocked here. Those 307 definitely seems strange, though.

Thing is, if the request isn't listed in devtools with a 2XX or 3XX, it should never appear as red, right?

Anyway, uBo seems pretty much the most standard solution here, and uMatrix while not maintained anymore have much of a common codebase with it (same developer). Also, as it seems you main browser is Chrome, it seems that as time will pass, adblockers will become less and less effective there, looking at Google stance on it and the limitation they progressively add to Chrome's addons (manifests v3 and so on…)

@d3ward
Copy link
Owner

d3ward commented Mar 10, 2023

Thing is, if the request isn't listed in devtools with a 2XX or 3XX, it should never appear as red, right?

Yes

I thought at first the 307 would be the issues here looking at the doubleclick ones, but one of those is correctly shown as blocked here. Those 307 definitely seems strange, though.

Exactly this is what confuses me too . It's weird , complex and annoying. Too many factors are there to be analyzed.

Also, as it seems you main browser is Chrome

Yes, but as a front-end dev, I basically use every browser out there ( Chrome , Brave, Firefox, Safari and Edge for now ) all with similar configurations
So far the best solution in my opinion is a good fast dns with basic blocking + ublock Origin

@nicolaasjan
Copy link

nicolaasjan commented Mar 12, 2023

It gets even weirder. 😀️

In Firefox with uBO 1.47.5b7, I get a score of 12%.
In Chromium with the same version of uBO, I get a score of 100%.

I think the test is fooled by redirect rule in uBlock filters:
||com/|$xhr,3p,redirect-rule=noop.txt

@ne20002
Copy link
Author

ne20002 commented Mar 21, 2023

I second this. Having a setup with multiple blockings (uBlock, Firefox buildin, /e/OS and a pi-hole ...
If I enable uBlock in Firefox Android, I get 12%. The sripts are green, all hostnames are red.
If I disable uBlock in Firefox Android I get 93%. The scripts are red and all (really all now) hostnames are green.

@Raieverr
Copy link

Raieverr commented Apr 7, 2023

@d3ward I can confirm that Firefox has some weird stuff going on with this test page (Unsure if it is the page itself or how UBO is blocking/reporting blocked connections). As shown below, I tested the latest Edge, Chrome, and Firefox browsers with different setups and recorded their scores.

Baseline (Browser security only):
Edge: 3%
Chrome: 3%
Firefox (Standard mode): 4%
Firefox (Strict mode): 38%

Test one (Default UBO settings):
Edge: 74%
Chrome: 74%
Firefox (Standard mode): 11%
Firefox (Strict mode): 12%

Test two (Best practice UBO settings):
Edge: 79%
Chrome: 79%
Firefox (Standard mode): 12%
Firefox (Strict mode): 12%

Test three (Default UBO settings + Your tracker list):
Edge: 100%
Chrome: 100%
Firefox (Standard mode): 12%
Firefox (Strict mode): 12%

Test four (Best practice UBO + Your tracker list):
Edge: 100%
Chrome: 100%
Firefox (Standard mode): 12%
Firefox (Strict mode): 12%

I took it a step further and checked dev tools for one URL (HotJar) across all three browsers, and on all three, UBO blocked it:
HotjarEdge
HotjarChrome
HotjarFirefox

Please let me know if you need anything else or want more testing, and I will happily provide it!

@sankhababu
Copy link

@d3ward Not all FF forks have the problem.
As I've Mull and Fennec f droid, both in my two mobile, with Mull it's working perfectly in both mobile, detected uBlock Origin well.
And failed with Fennec f droid in both set.
May this info help you.

@ne20002
Copy link
Author

ne20002 commented Apr 27, 2023

Current test gives me 91% with unchanged setup.

@bloodyeyesblackblood
Copy link

bloodyeyesblackblood commented Apr 29, 2023

maybe the problem here is "Enhanced Tracking Protection"?
at least my score is lower when it's also enabled.

uBO + Enhanced Protection OFF / uBO + Enhanced Protection ON

@d3ward
Copy link
Owner

d3ward commented Apr 29, 2023

Hi everyone, after a while I can confirm that there is a problem with Firefox + ublock Origin. Mostly the reason is related to how ubo works on Firefox to make it more performant compared to other browsers. More info here -> https://github.com/gorhill/uBlock/wiki/uBlock-Origin-works-best-on-Firefox

For now, the only solution to make the test tool work on Firefox + ubo is to add this rule in "My Filters".
@@*$redirect-rule.

I'm working on a feature to make this clearer to avoid confusion for users.

@d3ward
Copy link
Owner

d3ward commented Jul 16, 2023

The latest update includes a better notice for users, with an updated compatibility table that includes details of Firefox issues. Thank you all for so much input! This is the best I could come up with, without affecting non-Firefox users and not banning them in an aggressive way.

@d3ward d3ward closed this as completed Jul 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants