Skip to content

fix(cli): reject non-finite and overflowing timeouts - #38

Open
rupayon123 wants to merge 1 commit into
kavix:mainfrom
rupayon123:contribution/timeout-validation-20260912
Open

fix(cli): reject non-finite and overflowing timeouts#38
rupayon123 wants to merge 1 commit into
kavix:mainfrom
rupayon123:contribution/timeout-validation-20260912

Conversation

@rupayon123

Copy link
Copy Markdown
Contributor

Problem and change

Numeric --timeout values are parsed as floating-point seconds and converted to time.Duration. NaN currently becomes zero on arm64, silently disabling the timeout, while infinity and overflowing numbers are accepted with architecture-dependent conversion results.

Reject non-finite values and seconds whose nanosecond value is outside the duration range before conversion. Preserve zero, fractional seconds, ordinary seconds and Go duration strings.

Validation

Six new cases failed before the fix: NaN, Inf, +Inf, 1e100, 9223372037 and 9223372036.854776. The regression also checks negative infinity rejection and valid zero/fractional/large finite/duration-string inputs.

After the fix: env -u NO_COLOR go test ./..., go vet ./..., go build ./cmd/kurl, formatting and git diff --check pass. The default local environment sets NO_COLOR=1, which causes two existing printer color assertions to fail; the suite passes with that variable unset. golangci-lint is unavailable locally. Remote CI is separate and will be checked on the pushed head.

Prepared with AI assistance.

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.

1 participant