local-sandbox: allow reaching the exec daemon over a peer network - #243
Open
LeoneNee wants to merge 1 commit into
Open
local-sandbox: allow reaching the exec daemon over a peer network#243LeoneNee wants to merge 1 commit into
LeoneNee wants to merge 1 commit into
Conversation
The exec daemon URL is hard-coded to 127.0.0.1, which only works when core runs on the docker host itself. When core runs in a container (the shape deploy/core/Dockerfile produces), loopback is the core container, not the host publishing the sandbox port, so every exec, read, and write fails with fetch failed. With LOCAL_SANDBOX_PEER_NETWORK set, sandbox containers are connected to that docker network after run/start and core reaches the daemon by container name on AGENT_PORT. Unset keeps the loopback behavior used when core runs on the host. The daemon is unauthenticated, so this is only for a trusted internal network.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
local-sandboxreaches the sandbox exec daemon at a hard-codedhttp://127.0.0.1:<port>. That only works when core runs on the docker host itself. When core runs inside a container — the shapedeploy/core/Dockerfileproduces — loopback inside the core container is the container itself, not the host publishing the sandbox's mapped agent port. Every exec/read/write against the sandbox fails withfetch failed, and the agent reports its computer backend down.Change
With
LOCAL_SANDBOX_PEER_NETWORKset:docker run/docker start(docker network connect, idempotent)AGENT_PORTinstead of via the published loopback portUnset keeps the loopback behavior used when core runs on the host, so existing single-process setups are unaffected.
The exec daemon is unauthenticated (loopback binding is its access control), so this option is only for a trusted internal network — e.g. the private stack network shared with the core container, never a public one.
Tests
test/local-sandbox.test.tspasses (15/15). The option was also exercised end to end with core in a container: a turn executed in the sandbox container and a file written through the exec daemon was verified from the host volume.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.