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);
continue;
}
if ( opt.startsWith('csp=') ) {
if ( opt.length > 4 && this.reBadCSP.test(opt) === false ) {
this.parseTypeOption('data', not);
this.dataType = 'csp';
this.dataStr = opt.slice(4).trim();
}
if (
opt.startsWith('csp=') &&
opt.length > 4 &&
this.reBadCSP.test(opt) === false
) {
this.parseTypeOption('data', not);
this.dataType = 'csp';
this.dataStr = opt.slice(4).trim();
continue;
}
if ( opt === 'csp' && this.action === AllowAction ) {