1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02:00

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.
This commit is contained in:
Raymond Hill 2023-07-20 07:53:14 -04:00
parent 9d20cbe6af
commit 03d0d8d4ce
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -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; }