From fb6d69f543ffcb43856a68466b5820a162ccd0b4 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 24 May 2019 15:41:37 -0400 Subject: [PATCH] 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. --- src/js/static-net-filtering.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 6b41e7d7f..4ec419102 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -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 ) {