All exceptions filters are exempt from requiring a trusted source

Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/2895#discussioncomment-7566154
This commit is contained in:
Raymond Hill 2023-11-14 09:58:26 -05:00
parent 1e05665bdc
commit d2b8d990e6
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 6 additions and 4 deletions

View File

@ -235,8 +235,10 @@ const normalizeRawFilter = function(parser, sourceIsTrusted = false) {
if ( reng.aliases.has(token) ) { if ( reng.aliases.has(token) ) {
token = reng.aliases.get(token); token = reng.aliases.get(token);
} }
if ( sourceIsTrusted !== true && reng.tokenRequiresTrust(token) ) { if ( parser.isException() !== true ) {
return; if ( sourceIsTrusted !== true ) {
if ( reng.tokenRequiresTrust(token) ) { return; }
}
} }
args[0] = token.slice(0, -3); args[0] = token.slice(0, -3);
} }

View File

@ -1481,7 +1481,7 @@ export class AstFilterParser {
case NODE_TYPE_NET_OPTION_NAME_REPLACE: { case NODE_TYPE_NET_OPTION_NAME_REPLACE: {
realBad = abstractTypeCount || behaviorTypeCount || unredirectableTypeCount; realBad = abstractTypeCount || behaviorTypeCount || unredirectableTypeCount;
if ( realBad ) { break; } if ( realBad ) { break; }
if ( this.options.trustedSource !== true ) { if ( isException !== true && this.options.trustedSource !== true ) {
this.astError = AST_ERROR_UNTRUSTED_SOURCE; this.astError = AST_ERROR_UNTRUSTED_SOURCE;
realBad = true; realBad = true;
break; break;
@ -1496,7 +1496,7 @@ export class AstFilterParser {
case NODE_TYPE_NET_OPTION_NAME_URLTRANSFORM: case NODE_TYPE_NET_OPTION_NAME_URLTRANSFORM:
realBad = abstractTypeCount || behaviorTypeCount || unredirectableTypeCount; realBad = abstractTypeCount || behaviorTypeCount || unredirectableTypeCount;
if ( realBad ) { break; } if ( realBad ) { break; }
if ( this.options.trustedSource !== true ) { if ( isException !== true && this.options.trustedSource !== true ) {
this.astError = AST_ERROR_UNTRUSTED_SOURCE; this.astError = AST_ERROR_UNTRUSTED_SOURCE;
realBad = true; realBad = true;
break; break;