Problem
The proposal is tightly linked to the changes announced by the Chrome WebStore team, i.e. allowing "fast track" review to extensions in the case when only static rulesets.
In the case of content blocking extensions, static rulesets is a result of a conversion from traditional ad blocking rules to the DNR syntax and in order to make debugging rules possible we need to be able to show what the source rule was. In the current AdGuard prototype extension we achieve this by packing "source maps" alongside the static rulesets.
However, updating static rulesets means updating the source maps, and this will disallow "fast track" for the extension.
Proposal
The solution would be to store the metadata within the static ruleset file. This is actually even easier to understand than the current approach that we're using now.
We checked Chrome and FF and at the moment there's no limitation on "unknown" properties used in the JSON file in Chrome, in Firefox it silently ignores rules with unknown fields. So with Chrome we can already pack metadata into the static ruleset file and be eligible for "fast track". The problem is that this is unreliable, in the future there might be new fields that will intersect with the ones that we're using, or simply the rulesets parser behavior can be changed.
So I'd propose to mention in the documentation that there's a reserved property name (metadata for instance) that can be used for storing additional metadata, whichever the developer wants to store there.
Example:
{
"id" : 1,
"priority": 100000,
"action" : { "type" : "block" },
"condition" : {
"urlFilter" : "||example.org^",
"initiatorDomains" : ["foo.com"],
"resourceTypes" : ["script"]
},
"metadata": {
"source": "||example.org^$script,domain=foo.com,important"
}
}
Another example (a bit more complicated case, several source rules -> one DNR rule):
{
"id": 1,
"action": {
"type": "redirect",
"redirect": {
"transform": {
"queryTransform": {
"removeParams": [
"param1",
"param2"
]
}
}
}
},
"condition": {
"urlFilter": "||example.com^",
"resourceTypes": [
"xmlhttprequest"
],
"isUrlFilterCaseSensitive": false
},
"metadata": {
"source": [
"||example.com^$xmlhttprequest,removeparam=param1",
"||example.com^$xmlhttprequest,removeparam=param2"
]
}
}
Problem
The proposal is tightly linked to the changes announced by the Chrome WebStore team, i.e. allowing "fast track" review to extensions in the case when only static rulesets.
In the case of content blocking extensions, static rulesets is a result of a conversion from traditional ad blocking rules to the DNR syntax and in order to make debugging rules possible we need to be able to show what the source rule was. In the current AdGuard prototype extension we achieve this by packing "source maps" alongside the static rulesets.
However, updating static rulesets means updating the source maps, and this will disallow "fast track" for the extension.
Proposal
The solution would be to store the metadata within the static ruleset file. This is actually even easier to understand than the current approach that we're using now.
We checked Chrome and FF and at the moment there's no limitation on "unknown" properties used in the JSON file in Chrome, in Firefox it silently ignores rules with unknown fields. So with Chrome we can already pack metadata into the static ruleset file and be eligible for "fast track". The problem is that this is unreliable, in the future there might be new fields that will intersect with the ones that we're using, or simply the rulesets parser behavior can be changed.
So I'd propose to mention in the documentation that there's a reserved property name (
metadatafor instance) that can be used for storing additional metadata, whichever the developer wants to store there.Example:
{ "id" : 1, "priority": 100000, "action" : { "type" : "block" }, "condition" : { "urlFilter" : "||example.org^", "initiatorDomains" : ["foo.com"], "resourceTypes" : ["script"] }, "metadata": { "source": "||example.org^$script,domain=foo.com,important" } }Another example (a bit more complicated case, several source rules -> one DNR rule):
{ "id": 1, "action": { "type": "redirect", "redirect": { "transform": { "queryTransform": { "removeParams": [ "param1", "param2" ] } } } }, "condition": { "urlFilter": "||example.com^", "resourceTypes": [ "xmlhttprequest" ], "isUrlFilterCaseSensitive": false }, "metadata": { "source": [ "||example.com^$xmlhttprequest,removeparam=param1", "||example.com^$xmlhttprequest,removeparam=param2" ] } }