Fix --idle-timeout-seconds validation being skipped (#8009)

The lower bound check ran before the parser had resolved the value, so it
only saw a value with the --idle-timeout-seconds=<value> form. With the
space-separated form the value was still undefined at that point,
Number(undefined) is NaN, and NaN <= 60 is false, so anything got through.

Move the check below the block that pulls the value from the next
argument so both forms are validated the same way.
This commit is contained in:
Leo Camus
2026-09-20 12:53:04 +02:00
committed by GitHub
parent cd0f21dc72
commit 8a7bf87a4d
3 changed files with 19 additions and 4 deletions

View File

@@ -429,10 +429,6 @@ export const parse = (
throw new Error("--github-auth can only be set in the config file or passed in via $GITHUB_TOKEN")
}
if (key === "idle-timeout-seconds" && Number(value) <= 60) {
throw new Error("--idle-timeout-seconds must be greater than 60 seconds.")
}
const option = options[key]
if (option.type === "boolean") {
;(args[key] as boolean) = true
@@ -452,6 +448,10 @@ export const parse = (
throw error(`--${key} requires a value`)
}
if (key === "idle-timeout-seconds" && Number(value) <= 60) {
throw new Error("--idle-timeout-seconds must be greater than 60 seconds.")
}
if (option.type === OptionalString && value === "false") {
continue
}