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 <xhmikosr@gmail.com>
This commit is contained in:
XhmikosR
2025-05-15 19:46:53 +03:00
parent db48e5e32f
commit c72b7b872f

View File

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