Validate rules that specify more complex regex than allowed as part of the "regexFilter" key
Background
We have to convert ABP rules to DNR rules to make it working in MV3.
For this we convert the rules using text2dnr.js
.
Issue
When trying to deploy a webext for MV3 with the following rule:
{
"priority": 1000,
"condition": {
"regexFilter": "(https?:\\/\\/)104\\.197\\..{100,}",
"isUrlFilterCaseSensitive": false
},
"action": {
"type": "block"
},
"id": 29948
}
i get the following error message after successful deployment (as webext errors):
Rule with id 29948 specified a more complex regex than allowed as part of the "regexFilter" key.
What to change
Rules like this should not be present in filter lists and the FDA team will work to try to prevent this. However, filter lists are open source projects that we do not have full control over and don't serve only Mv3 extensions, so filters with regex that are too complex for DNR may still appear occasionally.
We should implement a check for this in our tooling to validate and skip these rules during the build process so that the extension deployment can never fail because of them.
In adblockpluscore
By default isRegexSupported
should return false
as per the original abp2dnr
, instead of true
Integration notes
If you need to have unchecked regex filter converter, call createConverter()
with {isRegexSupported: () => true}