New Update Replacing uMatrix

oldschool

Level 85
Thread author
Verified
Top Poster
Well-known
High Reputation
Forum Veteran
Mar 29, 2018
8,310
1
61,143
8,369
Republic of Gilead, Russian Federation
en.wikipedia.org

Introduction​

There used to be a fantastic chrome extension called uMatrix, written by Raymond Hill, the uBlock Origin developer. uMatrix was an intuitive way to control site permissions and subresource requests.

It looked like this:

uMatrix1
This isn’t something you’ll care about unless you’re a nerd – but it let you limit what third parties could serve subresource requests, and controlled access to features like frames, scripts, video, fonts and so on. You can do some of that manually with browser settings, but uMatrix made it quick and easy. This meant that what would otherwise be quite a laborious and fiddly way to browse the web became simple. Okay, not simple, but simpler.

Anyway, I enjoyed all the extra knobs to control website permissions.

The features in uMatrix were – more or less – a subset of the features available in uBlock Origin, so rather than maintain both, Hill deprecated uMatrix and users were encouraged to migrate to uBO.

This actually worked okay for me – uBO added some features I quite liked (e.g. cosmetic filters). and if you didn’t mind writing the more complex rules by hand, it could basically do everything uMatrix could do.

The bad news is that uBO is a legacy MV2 extension, and the successor – uBO Lite – removed this feature.

I really don’t want to give that up – is there a solution?

Options​

My question is could uMatrix even be possible under mv3?

declarativeNetRequest​

The main difference between mv2 and mv3 here is that it is no longer possible to block requests while you execute a callback, a so-called “blocking” web request.

If you want to intercept a request, it now has to be done declaratively. That just means instead of running some javascript on every single request, you have to declare what actions you want applied in advance.

Here is the controversial bit you’ve probably read about: You can’t do everything that was possible in a callback declaratively, so the capabilities have been nerfed. That is technically true, but practically the rules are flexible enough for everything I would ever want.

Policies​

The web already has a system to control features and subresources, it’s called Content Security Policy.

The obvious design is to use declarativeNetRequest to add our own Content-Security-Policy, then the browser will do all the work for us. All we need to do is provide a convenient interface to manage it.

Okay, but how will we offer a list of subresources to allow and deny? When you used uMatrix, it would show you a list of subresource types and origins, and let you manually approve or deny them.

This was the core thing uMatrix did well, so it’s essential. Well, I think CSP already provides a solution! There is a report-to directive that instructs the browser to post any security violations to a reporting endpoint.

All we have to do is enable that feature, add another declarativeNetRequest rule to catch those reports, then populate a list from the reports the browser sent. That’s another task successfuly offloaded 😂

Of course, this will take some plumbing, but the pieces are all there and it seems completely viable to me.

Outline​

So now that we have a rough outline for how it could work… someone just has to write a proof of concept. Ah fine, I’ll give it a shot.

Here is a first attempt, matrix³.

It is clearly in a prototype state, but it basically works. I thought I’d post about this on my blog and see if there’s any interest!

The code is minimal – no building or dependencies required, I didn’t use any frameworks. You can just git clone and then “Load Unpacked” in Chrome.

I am not a web developer, and I clearly have zero UX skills 🦎 Please let me know if this is a bad idea, you know a better solution, or you want to help!
Replacing uMatrix.
 
A.I. vibe coded again?
Highly doubtful. Tavis Ormandy admits it's experimental and he knows nothing about UI design but it works. Figuring out how to use it is another thing, at least for me.
This is matrix³, an experimental content policy manager, inspired by umatrix, but built on declarativeNetRequest.

It looks like this -- it adds a sidepanel that lets you enable or disable web features for each site.


This extension basically just provides an interface to Content-Security-Policy, so familiarity with the CSP3 specification is a bonus. It is currently just a prototype.
I think the last bit is kind of mandatory.
 
Highly doubtful. Tavis Ormandy admits it's experimental and he knows nothing about UI design but it works. Figuring out how to use it is another thing, at least for me.

I think the last bit is kind of mandatory.
Yeah it makes sense, he is probably one of the few people who needs that kind of control. I'd love to know how much phishing/hacking attacks he gets on a daily basis.

He could probably run a zero day phishing/malicious attacks service/feed on his own emails pool.
 
A.I. vibe coded again?
No he is respected security researcher famous for finding vulnerabilities in security software when he was leading researcher of Google's Project Zero. To reverse engineer and find low-level bugs you have to (at least) read programming code (assembly language, C and C++), On LinkedIn he tells nothing about his formal education, but to find the stuff he did he must have had a system engineer background (at least Bachelor) and specialized in Security and white-hat testing. Because he is around for so long and sort of set the standard in security research and policies which were based on the holes he found and methods he used to find it, My guess is that he does not hold a master's in IT-developemnt or security (otherwise he would not have designed such an awful, ugly and complex User Interface :-) )

In the past there was an Mv2 extension (policy control manager or something like that), which allowed to set the SCP using sliders and change the base line settings. A pitty Travis did not take a look at it or knew this old variant of uMatrix using CSP.

The UI is kind of rigid and does not allow cherry picking (e,g, using permissive mode with the lite-sandbox enabled and changed to allowing scripts and cookies, but blocking downloads and popups and insecure scripts and risky stylesheets). There is a slider to select a baseline policy, but it is not possible (at least I could not find one) to change the presets defaults. It is possible to define groups (e.g. trusted, 3p-CDN's, risky) and change the presets for that group and manually add domains to those groups, but that is as we call it in in Dutch ¨(splitting) a mile in seven" or taken the long way round (a detour increasing complexity and work)¨.

I played it with uMatrix3 for 40 minutes and think NoScript is a much much easier alternative to use..
 
Last edited:
No he is respected security researcher famous for finding vulnerabilities in security software when he was leading researcher of Google's Project Zero. To reverse engineer and find low-level bugs you have to (at least) read programming code (assembly language, C and C++), On LinkedIn he tells nothing about his formal education, but to find the stuff he did he must have had a system engineer background (at least Bachelor) and specialized in Security and white-hat testing. Because he is around for so long and sort of set the standard in security research and policies which were based on the holes he found and methods he used to find it, My guess is that he does not hold a master's in IT-developemnt or security (otherwise he would not have designed such an awful, ugly and complex User Interface :-) )
Yes I know who he is (y) This tool looks nice, I still use uMatrix on Firefox. How much longer will it continue work? Who knows.

To be honest he could just ask Gemini to code a UI and then send it around to friends to debug and fix. One of the few cases where A.I shines is coding.