Skip to content

docs(commands): document reconnecting to a background command - #318

Open
beran-t wants to merge 1 commit into
mainfrom
docs-background-codegen-example
Open

docs(commands): document reconnecting to a background command#318
beran-t wants to merge 1 commit into
mainfrom
docs-background-codegen-example

Conversation

@beran-t

@beran-t beran-t commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Adds a "Reconnect to a background command" section to docs/commands/background.mdx showing how to start a long-running command in one process, persist the sandbox ID and process ID, and reattach from a separate process with commands.connect(pid) and handle.wait(). Includes both JavaScript/TypeScript and Python examples plus notes on redirecting output to a file, disabling the command timeout, and persisting the IDs.

@cla-bot cla-bot Bot added the cla-signed label Jul 29, 2026
@@ -43,3 +43,71 @@ for stdout, stderr, _ in command:
command.kill()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Agentic Security Review
Severity: HIGH

The JavaScript example interpolates JSON.stringify(prompt) directly into a shell command. JSON.stringify is not shell-safe, so command substitution payloads like `...` or $(...) can still execute when the command is parsed by the shell.

If this documented pattern is reused in an API/serverless handler with attacker-controlled prompt, it can lead to arbitrary command execution in the sandbox job context.

Fix in Cursor Fix in Web

Reviewed by Cursor Security Reviewer for commit 1fc014a. Configure here.

@mintlify

mintlify Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
e2b 🟢 Ready View Preview Jul 29, 2026, 2:02 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant