Skip to content

fix(sandbox): bound run_process subprocess output (integrates #1028, fixes #1016) - #1036

Merged
AmitoVrito merged 3 commits into
mainfrom
integrate/sandbox-output-1028
Sep 9, 2026
Merged

AmitoVrito merged 3 commits into
mainfrom
integrate/sandbox-output-1028

Conversation

@AmitoVrito

Copy link
Copy Markdown
Collaborator

Integrates PR #1028 (by @MohamedIdhries) with the merge-time CHANGELOG entry.

Review outcome: MERGE

Implements the agreed design from #1016 correctly:

  • _drain_process reads stdout+stderr concurrently (no pipe deadlock), 64 KB chunks, kills the child on overflow, safe UTF-8 decode, [output truncated] marker only when genuinely over.
  • SandboxConfig.max_output_bytes (default 1 MB, validated > 0) threaded live through SandboxEnvironment into backend.run_process next to command_timeout — the field is not dead.
  • Non-breaking: defaulted kwarg on run_process and every backend exec; docker/fake forward it, lima/firecracker raise unavailable.
  • Real-subprocess regression tests (no MagicMock); the overflow test genuinely fails on the old communicate() path.

Non-blocking follow-up filed: PCSandbox constructor/attach do not yet plumb max_output_bytes (#1035) — the security fix itself is fully effective regardless.

Closes #1028. Fixes #1016.

Co-authored-by: MohamedIdhries [email protected]

@AmitoVrito
AmitoVrito merged commit f83a13f into main Sep 9, 2026
24 checks passed
@AmitoVrito
AmitoVrito deleted the integrate/sandbox-output-1028 branch September 9, 2026 16:26
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.

sandbox: bound subprocess output capture in run_process (apply #929 fix to sandbox exec path)

2 participants