Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/remove-output-size-limit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@cloudflare/sandbox': patch
---

Remove output size limit for command execution

The 10MB output size limit that was intended to prevent OOM attacks has been removed. This limit was too restrictive for legitimate use cases like reading large media files. Developers are now trusted to manage their own resource usage and handle potential OOM situations.
3 changes: 1 addition & 2 deletions docs/SESSION_EXECUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ mkfifo "$sp" "$ep"
## Error Handling and Limits

- Invalid `cwd` (foreground): we write a prefixed stderr line (binary prefix) indicating the failure and return exit code `1`.
- Output size limit: large logs are rejected during parsing to protect memory (`MAX_OUTPUT_SIZE_BYTES`).
- Timeouts: foreground commands can be configured to time out; an error is raised if the exit file does not appear in time.

## Why Two Patterns?
Expand All @@ -83,7 +82,7 @@ mkfifo "$sp" "$ep"

## Testing Notes

- Foreground tests cover silent commands (`cd`, variable assignment), error scenarios, multiline output, and size limits.
- Foreground tests cover silent commands (`cd`, variable assignment), error scenarios, and multiline output.
- Background/streaming tests cover concurrent output, stderr separation, and completion events.
- The previous hang class was caused by FIFO open/close races in foreground on silent commands; process substitution removes this class entirely.

Expand Down
46 changes: 15 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions packages/sandbox-container/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ const COMMAND_TIMEOUT_MS = (() => {
return val === 0 ? undefined : val;
})();

/**
* Maximum output size in bytes to prevent OOM attacks.
* This is a security measure, not a timeout.
*
* Default: 10MB
* Environment variable: MAX_OUTPUT_SIZE_BYTES
*/
const MAX_OUTPUT_SIZE_BYTES = parseInt(
process.env.MAX_OUTPUT_SIZE_BYTES || String(10 * 1024 * 1024),
10
);

/**
* Delay between chunks when streaming output.
* This debounces file system watch events for better performance.
Expand All @@ -68,7 +56,6 @@ export const CONFIG = {
INTERPRETER_SPAWN_TIMEOUT_MS,
INTERPRETER_EXECUTION_TIMEOUT_MS,
COMMAND_TIMEOUT_MS,
MAX_OUTPUT_SIZE_BYTES,
STREAM_CHUNK_DELAY_MS,
DEFAULT_CWD
} as const;
Loading
Loading