Skip to content

Commit

Permalink
Fix code scanning alert - Type confusion through parameter tampering
Browse files Browse the repository at this point in the history
Fixes: Fix code scanning alert - Type confusion through parameter tampering #1484

Change-type: patch
Signed-off-by: Harald Fischer <harald@balena.io>
  • Loading branch information
fisehara committed Nov 24, 2023
1 parent d804dd0 commit c2071a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/features/device-logs/lib/supervisor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
);
Expand Down

0 comments on commit c2071a3

Please sign in to comment.