From 66e3a1ad47162a89709e99072e5eaecdd83cb633 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 10 Jul 2024 12:43:36 -0400 Subject: [PATCH] Improve `href-sanitizer` scriptlet Related issue: https://github.com/uBlockOrigin/uBlock-issues/issues/3297 Mind that the sanitized URL can have Unicode characters beyond ASCII. --- assets/resources/scriptlets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index 80c251fb58f5d..d3aedadc20f6c 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -3477,7 +3477,7 @@ function hrefSanitizer( }; const validateURL = text => { if ( text === '' ) { return ''; } - if ( /[^\x21-\x7e]/.test(text) ) { return ''; } + if ( /[\x00-\x20\x7f]/.test(text) ) { return ''; } try { const url = new URL(text, document.location); return url.href;