Skip to content

fix(runner): fail safe on invalid output size config - #47

Open
fallintoplace wants to merge 1 commit into
ClickHouse:mainfrom
fallintoplace:fix/runner-safe-output-size
Open

fix(runner): fail safe on invalid output size config#47
fallintoplace wants to merge 1 commit into
ClickHouse:mainfrom
fallintoplace:fix/runner-safe-output-size

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Parse SANDBOX_OUTPUT_MAX_SIZE with safeInt, using 1024 when the value is invalid.

Why

The current Number(...) conversion turns a typo such as SANDBOX_OUTPUT_MAX_SIZE=banana into NaN. The runner uses this value in comparisons while streaming stdout and stderr. Every comparison with NaN is false, so the configured output cap is effectively disabled and output can keep accumulating in memory.

The existing safeInt helper already handles invalid, non-positive, and fractional values. This change uses that helper for the output limit only. Valid integer settings continue to work as before.

Tests

  • bun test api/src/config.test.ts api/src/validation.test.ts
  • Checked banana, -5, 3.7, and 2048 through the config module.

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