Won't block 3rd party properly
-
@SweetP Something seems to be wrong. The update just hit a moment ago and Minim seems to be blocking everything by default and ignores the Block Rules tab. Regardless of the options in Block Rules tab, the only rules written are the default
{ "trigger" : { "url-filter" : ".*" }, "action" : { "type" : "ignore-previous-rules" } }, { "trigger" : { "url-filter" : ".*" }, "action" : { "type" : "block" } },
I think the resource-type trigger field is missing from the default block rules and just the action (i.e. block) is being generated, thus blocking every URL.
-
@SweetP Update just hit. Seems to work well, except for a small issue with the way www and non-www domains get handled.
If you go to www.google.com and add an exception for it, Minim’s list will have google.com without the www part
This means that with the current behaviour it won’t load resources unless the user manually fixes the exceptions list and adds the www back.I think the regex for www matching is broken because of the extra escape char \ after www:
^https?:\/\/(www\\.)?google.com[:\/]
-
Also, if you completely unblock all resources for www.google.com, since no other "url-filter" rules gets generated and only the default "unless-domain” google.com gets added (without www part) the exception won’t apply.
I think the default behaviour of stripping the www part when adding an exception to Minim is no longer valid with this new better handling of domain/subdomain separation. In essence, www is a subdomain and should be treated as such.
-
@NickC said in Won't block 3rd party properly:
I think the default behaviour of stripping the www part when adding an exception to Minim is no longer valid with this new better handling of domain/subdomain separation. In essence, www is a subdomain and should be treated as such.
Ill look into this
as im also doing some www assumptions elsewhere in code.
but good points -
@NickC said in Won't block 3rd party properly:
@SweetP All seems to be working as expected. Thank you for doing this, Russell. With these changes Minim has become quite a fierce content blocker for Safari. Nothing quite like it.
That’s great,
Thanks for all the great feedback and suggestions. -
@SweetP Sadly, I think I found a bug
When adding www.youtube.com as an exception to default blocking rules, all third-party resources get loaded as well, despite explicit blocking in both Minim's default and the exceptions list.
{ "trigger" : { "load-type" : [ "third-party" ], "resource-type" : [ "script", "font", "style-sheet", "popup", "image", "media", "svg-document", "document", "raw", "ping", "fetch", "websocket", "other" ], "url-filter" : "^https?:\/\/www.youtube.com[:\/]" }, "action" : { "type" : "block" } }
These are the rules that get added and the standard unless-domain = www.youtube.com for the default blocking policy.
From what I could tell, everything should work as expected, however, third-party resources all load.
All other behaviour in Minim seems to work as expected, but as soon as you add an exception with first-party resources unblocked, somehow third-party get loaded as well despite the rule seemingly being correct.
-
@SweetP Another bug, if you unblock by default all first-party resources, the generic block rule for first-party gets generated but with an empty array for resource-type which blocks all resources, thus completely preventing any page from loading.
{ "trigger" : { "resource-type" : [ ], "load-type" : [ "first-party" ], "url-filter" : ".*" }, "action" : { "type" : "block" } },
-
@NickC said in Won't block 3rd party properly:
@SweetP Another bug, if you unblock by default all first-party resources, the generic block rule for first-party gets generated but with an empty array for resource-type which blocks all resources, thus completely preventing any page from loading.
good catch.
this is a simple fix, and it'll be in the next release -
@NickC said in Won't block 3rd party properly:
@SweetP Sadly, I think I found a bug
When adding www.youtube.com as an exception to default blocking rules, all third-party resources get loaded as well, despite explicit blocking in both Minim's default and the exceptions list.
I think this is unfortunately a limitation of the WebKit content blocking API
It looks as though you can load third party content via a first party script....
The only reliable way I could find to block all third party content on
YouTube
was to block all first and third party requests for the following domains:*doubleclick.net
*ggpht.com
*googleapis.com
*gstatic.com
*ytimg.com
in an update, ill remove the filter for adding domains to minim via the main app
-
@SweetP said in Won't block 3rd party properly:
It looks as though you can load third party content via a first party script...
That seems to be the case. I didn’t get to try any blocking with unless-top-url instead of the unless-domain. Might be a limitation of the domain selector itself when working with a URL filter.
-
I think I finally have a robust solution...
you set me on the right track withunless-top-url
Im working on v5 of Minim, which has this much better implementation.
I've also reworked the UI to be less confusing, and will be adding some rudimentary regex type support.