Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code scanning alert - Type confusion through parameter tampering #1485

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fisehara
Copy link
Contributor

Fixes: Fix code scanning alert - Type confusion through parameter tampering #1484

Change-type: patch

Fixes: Fix code scanning alert - Type confusion through parameter tampering #1484

Change-type: patch
Signed-off-by: Harald Fischer <harald@balena.io>
@fisehara fisehara linked an issue Nov 24, 2023 that may be closed by this pull request
1 task
@flowzone-app flowzone-app bot enabled auto-merge November 24, 2023 14:46
@@ -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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer this check to be higher up when grabbing req.body rather than nested a couple of levels deep where we would ideally expect the typings to be respected

@Page-
Copy link
Contributor

Page- commented Dec 21, 2023

Also I'd prefer a better commit message/changelog entry that mentions what the aim is now, eg that we're improving validation of logs sent to the store endpoint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix code scanning alert - Type confusion through parameter tampering
2 participants