From c2071a37746b78f6147b3c656dc683e9c2e783b2 Mon Sep 17 00:00:00 2001 From: Harald Fischer Date: Fri, 24 Nov 2023 15:39:00 +0100 Subject: [PATCH] Fix code scanning alert - Type confusion through parameter tampering Fixes: Fix code scanning alert - Type confusion through parameter tampering #1484 Change-type: patch Signed-off-by: Harald Fischer --- src/features/device-logs/lib/supervisor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/device-logs/lib/supervisor.ts b/src/features/device-logs/lib/supervisor.ts index 5c6a06c45..7e53f969d 100644 --- a/src/features/device-logs/lib/supervisor.ts +++ b/src/features/device-logs/lib/supervisor.ts @@ -9,7 +9,7 @@ const MAX_LOGS_PER_BATCH = 10; export class Supervisor { public convertLogs(logs: SupervisorLog[]): DeviceLog[] { - if (logs.length > MAX_LOGS_PER_BATCH) { + if (Array.isArray(logs) && logs.length > MAX_LOGS_PER_BATCH) { throw new errors.BadRequestError( `Batches cannot include more than ${MAX_LOGS_PER_BATCH} logs`, );