Hi.
I am working on the Declarative WebRequest API (
current state), a Chrome extension API that allows configuring rules according to which network requests may be modified.
To support the rules of HTTPS Everywhere (and also for many other use cases), I need to implement regular expressions support.
I see three options at the moment:
- use the RegEx engine of ICU (third_party/icu/public/i18n/unicode/regex.h)
- use the RegEx engine of V8
Using the V8 RegEx engine has the big advantage that it supports the RegEx syntax used by HTTPS Everywhere.
Using RE2 would have the big advantage that it guarantees runtime linear in the size of the input, and can have fixed memory limits (and it doesn't expose a giant attack surface). When drewry and taviso did a security analysis this engine won. The RegEx engine will be executed on user-supplied regular expressions.
What is your opinion?
For the context, this is what I would like to support (and more complex expressions):
var rule = {
conditions: [
new chrome.declarativeWebRequest.RequestMatcher({
url: { hostSuffix: '.example.com', schemes: ['http'] } })
],
actions: [
new chrome.declarativeWebRequest.RedirectRequest(
{regex: ['http://(.*)example.com/(.*)', 'https://$1example.com/$2']}
// exact syntax remains to be determined.
)
]};
chrome.declarativeWebRequest.onRequest.addRules([rule]);
Best regards,
Dominic