uBlock icon indicating copy to clipboard operation
uBlock copied to clipboard

[Enhancement] Extend Request Class Rule Syntax

Open ghost opened this issue 9 years ago • 12 comments

I would request that we be able to block/allow/noop more types of requests by default, at least in the rules portion (not necessarily bloat the UI).

Currently, we can manage inline scripts, file scripts, 1st and 3rd party frames, and images.

If we invoke the Dynamic URL filtering, we are able to handle any type of request that uMatrix supports, as well as fonts.

A use case I'd like to invoke, is block all requests by default in uBlock (already doable with a single click), but noop all CSS after it. I generally trust CSS files, but then we let the static filters and hostnames kick in, just in case someone likes to serve junk random CSS files for tracking purposes or something.

Another could be to simply block all webfonts, then allow by URL with the already working Dynamic URL filtering.

This could be done as follows:

* \* font block
* \* css noop

I currently use (of this type of rule):

* \* 3p block
* \* 3p-frame block

It syntactically fits very well with what already exists. I understand if you don't want to shove every request class into the left side uBlock popup, but these rules are just rejected as invalid.

The code to filter this seems to be intact, given that Dynamic URL filtering can allow/block/noop all requests, or a class of request, to a specific domain.

ghost avatar Jun 08 '15 19:06 ghost

This could be done as follows: * * font block * * css noop

I've already entertained the idea, as seen in the code: https://github.com/gorhill/uBlock/blob/master/src/js/url-net-filtering.js#L275.

However for now that code is commented out as can be seen, I have to assess very carefully performance if people starts using dynamic URL filters in large amount.

gorhill avatar Jun 08 '15 19:06 gorhill

Cool. Hopefully the benchmarks come out fine. I can see myself going over my sites and being more picky about JS files than just per domain, which could have me accumulate a lot of these dynamic URL rules.

ghost avatar Jun 08 '15 20:06 ghost

Any update on this, gorhill?

I'm still using "hard mode" with all third-party content blocked, but being able to allow third-party css through with a * * stylesheet noop would be my ideal blocking setup.

seanrand avatar Oct 26 '15 13:10 seanrand

but being able to allow third-party css through with a * * stylesheet noop would be my ideal blocking setup

What you want seems to be closer to what medium mode offers.

gorhill avatar Oct 26 '15 13:10 gorhill

It's in-between medium and hard. I'd still like to keep third-party images and everything except css blocked (and nooping them manually on demand). But yeah, I guess falling back to medium is the solution for me in the mean time, considering that most tracking pixels etc would still be blocked by the static filters.

seanrand avatar Oct 26 '15 13:10 seanrand

Medium Mode seems closer to what I currently use, but I wanted to migrate to hard, and there's no good way with the fonts to block by default and allow, at least with the UI.

I've actually installed a few icon fonts locally so sites that need them work, yet I don't have to waste the bandwidth downloading Font Awesome 100 times a day.

ghost avatar Oct 30 '15 13:10 ghost

@CODYQX4 no-remote-fonts: * true ?

@berrythesoftwarecodeprogrammar this is what I use, but then the only way to make exceptions is to then turn a certain site off.

There's no way to say, for example, block all fonts except from domain Y, on all sites, like you could with dynamic filtering. You'd have to allow a site all fonts, and then blacklist explicitly what you don't want, and they could change domains, so you can't really to a partial font whitelist but block by default via the site switch.

It had also made sense to me to allow CSS/Font in the advanced filter UI, as images are there, and uMatrix does that for CSS, but neither do for fonts.

ghost avatar Oct 30 '15 14:10 ghost

oh i see

@CODYQX4 Have you considered using Fanboy's Anti-thirdparty Fonts ?

Snapy avatar Nov 01 '15 17:11 Snapy

It's in-between medium and hard. I'd still like to keep third-party images and everything except css blocked

I would also like to block 3P Images, and noop it on demand. And this bug report also helps to resolve another issue i had mentioned at wildersecurity forum.

Hopefully @gorhill will find some time to review this!!

harshanvn avatar Dec 31 '15 08:12 harshanvn

This is why I'm still using uMatrix, even though the code has been archived. I use uMatrix with uBlock Origin's easy mode instead of just uBO in medium or hard mode because of the ability to allow third party css and images while blocking others including cookies (even with Cookie AutoDelete, it's nice to firewall them). It makes for a more usable-by-default experience, less maintenance. It's also much easier to see and control what's being blocked.

As of 2016 gorhill said he doesn't use uMatrix anymore and instead just uses uBO in medium, with 3rd party cookies blocked in browser settings. Again, when I tried this it was just more work since I had to fiddle with settings for each site, instead of only a few when using uMatrix with uBO in easy mode. And the cookie exceptions can be backed up easily along with all the other extension settings, instead of having them buried within my Firefox profile (I don't use/trust profile sync).

Regardless, thanks for uBO and uMatrix.

ahsodex avatar Mar 12 '21 14:03 ahsodex