fix: Dockerfile.browser build + env-file quoting regression#356
Merged
Conversation
1. Dockerfile.browser: Put CSS printf body on single line. Docker's parser strips continuation lines starting with '#' as comments, which destroyed the CSS selector content and broke the build. 2. runtime.py: Replace _quote_env_value with _sanitize_env_value. Docker --env-file reads values literally — no quote stripping or shell expansion. The previous implementation wrapped values in double quotes and added shell escapes, which would have passed literal quote characters to agent containers, crashing them on int(AGENT_PORT) and json.loads(MCP_SERVERS). The only escaping needed is newline → \n (two chars) to prevent env-file injection via multi-line values. 3. Added test for newline sanitization in env values.
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
Fixes two bugs found during principal engineer review of the production readiness changes:
Dockerfile.browser build failure — Docker's parser strips continuation lines starting with
#as Dockerfile comments, even inside shell strings. The CSS selector lines (#noVNC_logo, etc.) were being stripped, destroying the printf string and its closing quote. Fixed by putting the entire printf body on a single line.CRITICAL:
_quote_env_valuebroke Docker--env-fileparsing — Docker's--env-filereads values literally after=with no quote stripping or shell expansion. The previous implementation wrapped values in"..."and added shell escapes (\$,\`), which would pass literal quote characters to agent containers. This would crash agents onint(AGENT_PORT)(gets"8400"instead of8400) andjson.loads(MCP_SERVERS).Replaced with
_sanitize_env_valuethat only escapes newlines (the one format-breaking character for line-based env files).Added test for newline sanitization in env values.
Test plan
docker build -t openlegion-browser:latest -f Dockerfile.browser .— builds successfullypytest tests/test_runtime.py— 54 passedpytest tests/ --ignore=tests/test_dashboard.py— 1595 passed, 45 skipped--env-filetreats quotes as literal:echo 'VAR="val"'→ container gets"val"with quotes