From 401d2e8ea9f31720a1ea05943be37e4275182a17 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Tue, 10 Sep 2024 11:50:09 -0400 Subject: [PATCH] [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. --- src/js/static-net-filtering.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 967e87687..052321777 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -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, '' ],