mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 12:48:29 +00:00
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:
@@ -212,11 +212,9 @@ function deleteMultipleSessions(ids) {
|
|||||||
// Check input validity
|
// Check input validity
|
||||||
if (!Array.isArray(ids)) return;
|
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) {
|
for (const id of ids) {
|
||||||
// TODO Fix eslint
|
if (!Number.isInteger(id)) return;
|
||||||
// eslint-disable-next-line unicorn/prefer-number-properties
|
|
||||||
if (Object.hasOwn(ids, id) && isNaN(ids[id])) return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert all ids to integers
|
// Convert all ids to integers
|
||||||
|
|||||||
Reference in New Issue
Block a user