Regex Filters and Redirects

315 views
Skip to first unread message

Simeon Vincent

unread,
Jun 27, 2019, 2:29:35 PM6/27/19
to Chromium Extensions
Hey extension devs,

I've got a quick update on the declarativeNetRequest API for you. In response to developer feedback, the Chrome Extensions team has been iterating on the redirect capabilities of the API would like feedback on some proposed additions. Briefly, we're planning to:
  • Add regular expression URL filters to make rules more flexible
  • Add an upgradeScheme action to upgrade from an insecure scheme to a secure one
  • Add support for URL transformation including regex substitutions
Full details on the proposed changes can be found in the Declarative Net Request: Regex Filters and Redirects doc. We're looking forward to your feedback 😊

Simeon - @dotproto
Extensions Developer Advocate

wOxxOm

unread,
Jun 28, 2019, 10:35:13 AM6/28/19
to Chromium Extensions
  1. Might be helpful to have an API to query the internal performance metrics that Chrome supposedly maintains for these rules so the extension developers can optimize the performance easily. Without such an API they would have to use the arcane and unwieldy chrome://tracing, I'm afraid.

  2. It should be noted that only a limited subset of RegExp is supported due to the use of RE2 engine so there are some patterns that cannot be implemented via DNR+RE2, for example embedded backreferences and lookahead/lookbehind assertions. To be fair, those are rarely used in the wild, apparently, and some cases can even be rewritten to run in RE2.

Shwetank Dixit

unread,
Jul 1, 2019, 2:35:38 PM7/1/19
to Chromium Extensions
Hi Simeon,

All these 3 are welcome updates IMO. One thing I would suggest is having a way to redirect based on HTTP response headers. This would be useful to counter certain kinds of circumvention as well as a few other techniques for server side ad insertion. 

I know the doc says the exact number isn’t ready yet, but can you share maybe the ballpark figure for the number of regex filters? Also, clubbing some more stuff in here, it would be great to also know if there is any update on the number of dynamic rules allowed in dNR (is it still 5k or more, now that the limit has increased to 150k). 

I think implementing exception rules would be important since its used by a number of ad blockers currently - the current solution in the dNR api is too broad, and having a bit more fine grained control would be better. It would also be important to know  the ways of failure when the limit rule of 150k is crossed (if an extension already using a lot of rules, and another one is installed crossing the total of 150k rules, then what is supposed to happen and how does the affected extension deal with this scenario). 

Cheers,
Reply all
Reply to author
Forward
0 new messages