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) ) {
token = reng.aliases.get(token);
}
if ( sourceIsTrusted !== true && reng.tokenRequiresTrust(token) ) {
return;
if ( parser.isException() !== true ) {
if ( sourceIsTrusted !== true ) {
if ( reng.tokenRequiresTrust(token) ) { return; }
}
}
args[0] = token.slice(0, -3);
}

View file

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