uMatrix icon indicating copy to clipboard operation
uMatrix copied to clipboard

[Request] Group similar rules with different types into a single rule with many types

Open zero77 opened this issue 7 years ago • 12 comments

To keep the “my rules” page tidy is it possible to have more than one request type per rule. google.com google.com xhr,frame,other allow thanks

zero77 avatar Nov 21 '17 16:11 zero77

Please provide sensible title to issue you open, these are used for others to lookup issues, and it helps by not burdening me with the task of having to edit your issue. Is the following excerpt not clear in CONTRIBUTING?

you benefit from the carefully crafted code, return the favor by carefully crafting issues/bug reports.

gorhill avatar Nov 21 '17 17:11 gorhill

Apologies, I will take this into consideration in the future.

zero77 avatar Nov 21 '17 20:11 zero77

this makes things a little more complicated syntax wise because then multiple ways of writing rules exist but it makes the list a lot smaller. what i think that would be even more effient if you go that route would be meta rules like "all-except-cookies" or "video-frame" which is basically a generic row that can be applied to any domain you like and that can be changed globally. if umatrix one day become more fine grained this could prove handy. they would be defined with a directive and can then be used like regular request types.

elypter avatar Nov 24 '17 11:11 elypter

Rules have to map to src des type action internally, this won't change, this is essentially uMatrix at its core. The suggestion here translate very well back and forth to uMatrix's internal syntax. Anything else that does not translate well into src des type action won't work and will just make the code unduly complicated -- not a good thing for stability.

gorhill avatar Nov 24 '17 12:11 gorhill

this would still have the same syntax. just more keywords for type. for example:

yahoo.com search.yahoo.com except-cookies allow

this would allow every request on yahoo.com to search.yahoo.com except cookies

for this to work you would have to add a new directive: custom-type: type-name type action

for example: custom-type: except-cookie * allow custom-type: except-cookie cookie block

this could even be expanded for a whole scope by adding destinations to the syntax. this way you could reuse a ruleset made for one website for another or make templates for general types of websites and only adjust whats different between them. for example to allow embedded youtube videos easily on a set of sites without having to allow google globally. this would also be useful to temporarily unbreak sites like suggested here(point 2) https://discourse.mozilla.org/t/support-umatrix/5131/34 and it could also be used to give the host lists a different default behavior

template: type-name des type action

for example: template: except-cookie 1st-party * allow template: except-cookie * cookie block template: except-cookie 1st-party cookie block

i dont know if it is really needed and its a big change but i think if that if the syntax should be extended this would be a good and flexible way.

elypter avatar Nov 24 '17 13:11 elypter

I was thinking of something along the lines of:

google.com mail.google.com cookie,xhr,other allow

zero77 avatar Nov 28 '17 15:11 zero77

Yeah, the idea is that the type field could be a list of comma separated types instead of only one.

ArchangeGabriel avatar Nov 28 '17 15:11 ArchangeGabriel

@ArchangeGabriel yes, exactly.

zero77 avatar Nov 28 '17 15:11 zero77

I was thinking of something along the lines of:

That was my understanding of your suggestion, and what I was planning to do, including keeping the types ordered as per current order in the matrix UI.

gorhill avatar Nov 28 '17 15:11 gorhill

@gorhill thanks.

zero77 avatar Nov 28 '17 16:11 zero77

As I see it, the main goal of this request is to make "My rules" tab easier to work with. But grouping is not the best way to make it happen. Also, it complicates the implementation of my ideas. I think the best ways of improving usability are:

  1. Search. Hide rules that doesn't contain given string (or doesn't match regexp).
  2. Diff. Hide the same rules in Permanent and Temporary halves. Useful to review what you've changed before closing the browser.

mikhaelkh avatar Dec 29 '17 21:12 mikhaelkh

That’s a good idea but it’s not really what I was after in this request. I like the my rules tab and I find it easy to work with.

But, I am finding its getting a bit messy as I have lots of rules and in particular multiple rules for the same domains.

So I think combining rules for the same domain would solve this and make the my rules tab a lot neater and easer to work with as a result.

zero77 avatar Jan 03 '18 12:01 zero77