Discard whole filter with bad `csp=` content

Related discussion:
- https://www.reddit.com/r/uBlockOrigin/comments/bshn7z/

uBO was just removing the bad option, while the whole
filter needs to be discarded.
This commit is contained in:
Raymond Hill 2019-05-24 15:41:37 -04:00
parent dafe5fd045
commit fb6d69f543
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 8 additions and 6 deletions

View File

@ -1990,12 +1990,14 @@ FilterParser.prototype.parseOptions = function(s) {
this.parsePartyOption(true, not); this.parsePartyOption(true, not);
continue; continue;
} }
if ( opt.startsWith('csp=') ) { if (
if ( opt.length > 4 && this.reBadCSP.test(opt) === false ) { opt.startsWith('csp=') &&
this.parseTypeOption('data', not); opt.length > 4 &&
this.dataType = 'csp'; this.reBadCSP.test(opt) === false
this.dataStr = opt.slice(4).trim(); ) {
} this.parseTypeOption('data', not);
this.dataType = 'csp';
this.dataStr = opt.slice(4).trim();
continue; continue;
} }
if ( opt === 'csp' && this.action === AllowAction ) { if ( opt === 'csp' && this.action === AllowAction ) {