From 048e0fb9ac570707d4c96faaf98bb6a2ac184dce Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 9 Jul 2026 16:09:48 +0000 Subject: [PATCH] Tighten Windows process number guards Co-authored-by: Julius Marminge --- apps/server/src/diagnostics/ProcessDiagnostics.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/server/src/diagnostics/ProcessDiagnostics.ts b/apps/server/src/diagnostics/ProcessDiagnostics.ts index 83b4a8ea32..c2c8bd49f5 100644 --- a/apps/server/src/diagnostics/ProcessDiagnostics.ts +++ b/apps/server/src/diagnostics/ProcessDiagnostics.ts @@ -154,11 +154,15 @@ const decodeWindowsProcessRowsJson = Schema.decodeUnknownOption(WindowsProcessRo const decodeWindowsProcessRowJson = Schema.decodeUnknownOption(WindowsProcessRowJson); function positiveIntegerOption(value: number | undefined): Option.Option { - return Number.isInteger(value) && value > 0 ? Option.some(value) : Option.none(); + return typeof value === "number" && Number.isInteger(value) && value > 0 + ? Option.some(value) + : Option.none(); } function nonNegativeIntegerOption(value: number | undefined): Option.Option { - return Number.isInteger(value) && value >= 0 ? Option.some(value) : Option.none(); + return typeof value === "number" && Number.isInteger(value) && value >= 0 + ? Option.some(value) + : Option.none(); } export function parsePosixProcessRows(output: string): ReadonlyArray {