feat(sandbox): isolate image:* ENV secrets via proxy sidecar container#55
Open
geminixiang wants to merge 3 commits into
Open
feat(sandbox): isolate image:* ENV secrets via proxy sidecar container#55geminixiang wants to merge 3 commits into
geminixiang wants to merge 3 commits into
Conversation
For image:* sandboxes, known AI service API keys (Anthropic, OpenAI, OpenRouter) are no longer injected into the sandbox container environment. Instead a lightweight Node.js proxy container is provisioned on the same Docker network; the sandbox receives proxy base URLs and dummy placeholder key values, so malicious code running `env` inside the sandbox cannot obtain the real credentials. - SecretProxyManager: provisions/stops/removes per-user proxy containers running the embedded HTTP reverse-proxy script in node:20-alpine - Proxy strips inbound auth headers and injects the real key before forwarding to the upstream API (streaming via pipe) - ContainerLifecycleHooks added to DockerContainerManager so proxy containers are stopped/removed alongside their sandbox counterparts - SecretProxyManager threaded through CommandServices → SessionRuntime → createRunner so a single shared instance handles both provisioning and lifecycle cleanup https://claude.ai/code/session_01DFxUg9kw52rqDGP4YFosiN
Remove secretProxyManager from shared interfaces (CommandServices, createRunner signature, session-runtime) to keep image:* concerns isolated. ActorExecutionResolver now self-creates the proxy manager when baseConfig.type === "image", so no caller plumbing is needed. Also simplify SecretProxyManager to write the embedded proxy script to a fixed temp path (mama-proxy-server.mjs) instead of a unique mkdtemp dir, allowing multiple instances to coexist without shared mutable state. https://claude.ai/code/session_01DFxUg9kw52rqDGP4YFosiN
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.
For image:* sandboxes, known AI service API keys (Anthropic, OpenAI,
OpenRouter) are no longer injected into the sandbox container environment.
Instead a lightweight Node.js proxy container is provisioned on the same
Docker network; the sandbox receives proxy base URLs and dummy placeholder
key values, so malicious code running
envinside the sandbox cannotobtain the real credentials.
running the embedded HTTP reverse-proxy script in node:20-alpine
forwarding to the upstream API (streaming via pipe)
containers are stopped/removed alongside their sandbox counterparts
→ createRunner so a single shared instance handles both provisioning
and lifecycle cleanup
https://claude.ai/code/session_01DFxUg9kw52rqDGP4YFosiN