From c72b7b872f80fd7d6209c7b0865ae655c08715ea Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 15 May 2025 19:46:53 +0300 Subject: [PATCH] settings-api: fix wrong code `ids` is an array so `id` is the value when using a for...of loop. Also, switch to Number.isInteger since we expect the IDs to be numbers Signed-off-by: XhmikosR --- scripts/js/settings-api.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/js/settings-api.js b/scripts/js/settings-api.js index 64b3cc26..1e1fdf43 100644 --- a/scripts/js/settings-api.js +++ b/scripts/js/settings-api.js @@ -212,11 +212,9 @@ function deleteMultipleSessions(ids) { // Check input validity if (!Array.isArray(ids)) return; - // Exploit prevention: Return early for non-numeric IDs + // Exploit prevention: return early for non-numeric IDs for (const id of ids) { - // TODO Fix eslint - // eslint-disable-next-line unicorn/prefer-number-properties - if (Object.hasOwn(ids, id) && isNaN(ids[id])) return; + if (!Number.isInteger(id)) return; } // Convert all ids to integers