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

Simplest way to allow a family of URLs? #862

Closed
RoxKilly opened this issue Oct 26, 2015 · 9 comments
Closed

Simplest way to allow a family of URLs? #862

RoxKilly opened this issue Oct 26, 2015 · 9 comments

Comments

@RoxKilly
Copy link

FF 41
uBlock.0 1.3.1
Windows 7

I use dynamic filtering with the following rules: * * 1p-script block * * 3p-frame block * * 3p-script block * * inline-script block. When a site requires JS to work, it very often relies on JQuery, most often from a Google CDN. I'd like to find a way to white-list these scripts from all domains. I envision that most of the time, they will not be run, but when I enable 1st-party scripts and these external libraries are called, they will automatically be connected.

The Google hosted JS libraries can be found here. I am particularly interested in allowing the JQuery scripts. They are of the form https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js. Problem is, there are a couple dozens of them for the different versions, so I have a two part question.

  1. Is there a way to white-list a regex? eg: ^/http(s)?://ajax.googleapis.com/ajax/libs/jquery/[\d].[\d].[\d]/jquery.min.js$/

  2. If so, would uBlock's performance be faster if I manually entered all such links? in the My Rules tab instead of relying on a regex?

@publicarray
Copy link

Some common domains that I have nooped:

* ajax.googleapis.com * noop
* akamaihd.net * noop
* bootstrapcdn.com * noop
* cloudflare.com * noop
* google.com * noop
* gstatic.com * noop
* jquery.com * noop
* jwpcdn.com * noop
* vimeocdn.com * noop
* wp.com * noop
* www.googleapis.com * noop
* youtube-nocookie.com * noop
* youtube.com * noop
* ytimg.com * noop

@RoxKilly
Copy link
Author

Thanks. I don't want to open up the whole ajax.googleapis.com subdomain though, just the JQuery scripts.

By the way, doesn't * google.com * noop bother you? This allows all google.com hosted scripts to run unless a static filter stops them. Privacy-wise it makes me a bit uncomfortable. * cloudflare.com * noop would worry me even more because any site can cache its scripts on Cloudflare so I would have no idea what kind of scripts I'm allowing with that rule.

@harshanvn
Copy link

If so, would uBlock's performance be faster if I manually entered all such links? in the My Rules tab

I believe plain string are faster..

I don't want to open up the whole ajax.googleapis.com subdomain though

You can use dynamic URL filtering for that. Here is the rule i use..
* https://ajax.googleapis.com/ajax/libs/jquery script noop

And here are the other global rules i use, in one of the machine -

* http://ajax.aspnetcdn.com/ajax script noop
* http://cdnjs.cloudflare.com/ajax/libs/jquery script noop
* http://netdna.bootstrapcdn.com/bootstrap script noop
* https://ajax.aspnetcdn.com/ajax script noop

Edit: Only quirk is that, if the site is requesting the resource from http instead, you would have to create another entry for http as below..
* http://ajax.googleapis.com/ajax/libs/jquery script noop

Note: I converted almost all my dynamic filtering rules to dynamic URL Filtering. This allows more granular rules, without opening much..

@publicarray
Copy link

By the way, doesn't * google.com * noop bother you? This allows any google.com hosted script from to run unless a static filter stops them. Privacy-wise it makes me a bit uncomfortable. * cloudflare.com * noop would worry me even more

You raise a good point but I am probably not as paranoid. I prefer to have more websites that work rather than to add more rules. In other words in this case I prefer convenience over privacy. Another point is that I only nooped them. This means they're falling back to filter lists, which should block the majority of tracking scripts and other bad scripts.
P.S. Based on your comment I have removed cloudflare.com from my dynamic rules. 🎉

@RoxKilly
Copy link
Author

@harshanvn that's interesting thanks. I'll try that. It's probably targeted enough even though it doesn't take into account the full URL, so I'd be comfortable with it.

@gorhill
Copy link
Owner

gorhill commented Oct 26, 2015

@harshanvn:

You can use dynamic URL filtering for that. Here is the rule i use..
* https://ajax.googleapis.com/ajax/libs/jquery script noop

Yes, that is the answer.

@RoxKilly
Copy link
Author

Didn't know dynamic filtering looked beyond the domain. That's good news. Is the path case-sensitive? In other words would * https://ajax.googleapis.com/ajax/libs/jquery script noop match https://ajax.googleapis.com/ajax/libs/JQUERY

Having just re-read @harshanvn's answer, I realize that this is a dynamic URL filtering rule, not the classic dynamic filtering. Do dynamic URL filters go in the My Rules tab along with the rest? (those that target domains)

@gorhill
Copy link
Owner

gorhill commented Oct 26, 2015

Didn't know dynamic filtering looked beyond the domain

It's more accurately "dynamic URL filtering". See "Overview of uBlock's network filtering engine".

@RoxKilly
Copy link
Author

For reference to anyone else who runs into this: here is the page explaining Dynamic URL Filtering in detail.

In the last paragraph of that page, @gorhill calls for a better example of the usefulness of Dynamic URL Filtering's granularity. The problem I ran into is a good case in point. I am not interested in allowing all scripts from ajax.googleapis.com, but JQuery is so common that instead of finding myself noop-ing that domain on site after site, I can create the relevant dynamic URL filters (http and https versions) and be done with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants