feat: propagate NO_PROXY and configurable env vars into sandbox execution environment#273
Merged
Merged
Conversation
Contributor
Author
|
@crazywoola @wylswz @BeautyyuYanli That said, the existing dify-sandbox is still very easy to use without any special setup, so I believe there is still sufficient demand for it. For that reason, I submitted this enhancement. I’d appreciate it if you could consider merging it and releasing it. Thanks! |
BeautyyuYanli
approved these changes
Jun 15, 2026
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.
Summary
Sandbox-injected environment variables (e.g. custom CA paths,
NO_PROXY) were silently dropped at the boundary between the container process and the sandboxed Python/Node.js subprocess.This PR fixes that by:
NO_PROXYautomatically alongside the existing proxy variables.HTTP_PROXY/HTTPS_PROXYnot being forwarded in the Node.js runner (bug parity with Python runner).allowed_env_vars— an administrator-controlled whitelist of environment variable names to forward from the container into the execution environment.Closes #272
Configuration
Or via environment variables:
Tests
Container configuration:
Tested with following
docker-compose.override.yaml:App:
In code blocks, I run code in both Python and JavaScript that simply prints the value of a specified environment variable.
If the environment variable does not exist, output
UNDEFINED.Result:

I can confirm:
NO_PROXYis automatically propagated.MY_CUSTOM_VARandANOTHER_VARare propagated byALLOWED_ENV_VARSUNLISTED_SECRETis NOT propagated since it is not listed inALLOWED_ENV_VARS