[mv3] Mind unsupported `header=`/`ipaddress` options in DNR API

Properly report unsupported `header=` and `ipaddress=` option in
log file.

`header=` support may become possible soon with Chromium 128
introducing blocking according to response headers content.
This commit is contained in:
Raymond Hill 2024-09-10 11:50:09 -04:00
parent 030d7334e4
commit 401d2e8ea9
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 10 additions and 1 deletions

View File

@ -2905,7 +2905,7 @@ class FilterStrictParty {
static dnrFromCompiled(args, rule) {
const partyness = args[1] === 0 ? 1 : 3;
dnrAddRuleError(rule, `FilterStrictParty: Strict partyness strict${partyness}p not supported`);
dnrAddRuleError(rule, `strict${partyness}p not supported`);
}
static keyFromArgs(args) {
@ -2953,6 +2953,10 @@ class FilterOnHeaders {
);
}
static dnrFromCompiled(args, rule) {
dnrAddRuleError(rule, `header="${args[1]}" not supported`);
}
static logData(idata, details) {
const irefs = filterData[idata+1];
const headerOpt = filterRefs[irefs].headerOpt;
@ -3042,6 +3046,10 @@ class FilterIPAddress {
return filterDataAlloc(args[0], filterRefAdd(details));
}
static dnrFromCompiled(args, rule) {
dnrAddRuleError(rule, `"ipaddress=${args[1]}" not supported`);
}
static logData(idata, details) {
const irefs = filterData[idata+1];
details.options.push(`ipaddress=${LogData.requote(filterRefs[irefs].pattern)}`);
@ -4432,6 +4440,7 @@ StaticNetFilteringEngine.prototype.dnrFromCompiled = function(op, context, ...ar
[ CSP_REALM, { type: 'csp', priority: 0 } ],
[ PERMISSIONS_REALM, { type: 'permissions', priority: 0 } ],
[ URLTRANSFORM_REALM, { type: 'uritransform', priority: 0 } ],
[ HEADERS_REALM, { type: 'block', priority: 0 } ],
]);
const partyness = new Map([
[ ANYPARTY_REALM, '' ],