From 03d0d8d4ce7ac64434266e25b0ff402245720f65 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 20 Jul 2023 07:53:14 -0400 Subject: [PATCH] Eliminate case-sensitivity from values in `set-cookie` scriptlet Related discussion: - https://github.com/uBlockOrigin/uAssets/discussions/18762#discussioncomment-6338716 Additionally, add `allow` as valid value. --- assets/resources/scriptlets.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index dffc94c784561..0e6eca366d9eb 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -784,7 +784,7 @@ function setLocalStorageItemCore( value = `${Date()}`; } } else { - if ( trustedValues.includes(value) === false ) { + if ( trustedValues.includes(value.toLowerCase()) === false ) { if ( /^\d+$/.test(value) === false ) { return; } value = parseInt(value, 10); if ( value > 32767 ) { return; } @@ -2896,15 +2896,14 @@ function setCookie( if ( name === '' ) { return; } name = encodeURIComponent(name); - const validValues = new Set([ - 'true', 'True', - 'false', 'False', - 'yes', 'Yes', 'y', 'Y', - 'no', 'No', 'n', 'N', - 'ok', 'OK', - 'Accept', 'Reject', - ]); - if ( validValues.has(value) === false ) { + const validValues = [ + 'true', 'false', + 'yes', 'y', 'no', 'n', + 'ok', + 'accept', 'reject', + 'allow', + ]; + if ( validValues.includes(value.toLowerCase()) === false ) { if ( /^\d+$/.test(value) === false ) { return; } const n = parseInt(value, 10); if ( n > 15 ) { return; }