Skip to content

fix: propagate sandbox proxy environment aliases#736

Open
ousamabenyounes wants to merge 1 commit into
usestrix:mainfrom
ousamabenyounes:fix/issue-430
Open

fix: propagate sandbox proxy environment aliases#736
ousamabenyounes wants to merge 1 commit into
usestrix:mainfrom
ousamabenyounes:fix/issue-430

Conversation

@ousamabenyounes

@ousamabenyounes ousamabenyounes commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix #430

Build the sandbox environment in one helper and propagate proxy settings through lowercase and uppercase aliases, including all_proxy and no_proxy, plus the CA bundle variables used by common Python and TLS tooling.

This keeps subprocesses spawned inside the sandbox on the same Caido proxy and trust configuration while preserving localhost bypass behavior for tools that only read lowercase proxy variables.

Test verification (RED -> GREEN)

RED with the production fix reverted while keeping the test:

uv run pytest tests/test_session_entries.py -q
ImportError: cannot import name 'build_sandbox_environment' from 'strix.runtime.session_manager'
1 error

GREEN with the fix applied:

uv run pytest tests/test_session_entries.py -q
5 passed

Additional validation:

uv run pytest
181 passed, 2 warnings

uv run ruff check strix/runtime/session_manager.py tests/test_session_entries.py
All checks passed!

uv run ruff format --check strix/runtime/session_manager.py tests/test_session_entries.py
2 files already formatted

uv run mypy strix/runtime/session_manager.py
Success: no issues found in 1 source file

uv run pyright strix/runtime/session_manager.py
0 errors, 0 warnings, 0 informations

uv run bandit -q -c pyproject.toml strix/runtime/session_manager.py
exit 0

@greptile-apps

greptile-apps Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR centralizes sandbox environment setup and expands propagated proxy settings. The main changes are:

  • Adds a build_sandbox_environment() helper.
  • Propagates uppercase proxy aliases into the sandbox manifest.
  • Adds CA bundle variables for Python and TLS tooling.
  • Adds tests for the new helper output.

Confidence Score: 4/5

The sandbox environment path needs a small proxy-alias fix before merging.

  • The new helper matches the existing container proxy and CA bundle values.
  • Some subprocess tools can ignore uppercase-only ALL_PROXY and NO_PROXY.
  • Localhost traffic can be routed through Caido instead of staying local when lowercase no_proxy is missing.

strix/runtime/session_manager.py

Security Review

Sandbox subprocesses can miss the intended proxy or localhost bypass behavior when they only honor lowercase all_proxy or no_proxy.

Important Files Changed

Filename Overview
strix/runtime/session_manager.py Centralizes sandbox environment construction and uses it when creating the sandbox manifest, but misses lowercase proxy aliases.
tests/test_session_entries.py Adds direct assertions for the new environment helper and the expected proxy and CA bundle values.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
strix/runtime/session_manager.py:47-48
**Lowercase Proxy Aliases Missing**

When sandbox subprocesses rely on lowercase proxy variables, `ALL_PROXY` and `NO_PROXY` are ignored. A tool that only reads `no_proxy` can send `127.0.0.1` traffic through the Caido proxy at `127.0.0.1:48080`, so local CDP or service calls can loop through the proxy instead of staying local.

```suggestion
        "ALL_PROXY": container_caido_url,
        "all_proxy": container_caido_url,
        "NO_PROXY": _NO_PROXY_VALUE,
        "no_proxy": _NO_PROXY_VALUE,
```

Reviews (1): Last reviewed commit: "fix: propagate sandbox proxy environment..." | Re-trigger Greptile

Comment thread strix/runtime/session_manager.py
Centralize sandbox subprocess environment setup and include lowercase all_proxy/no_proxy aliases alongside uppercase proxy aliases and CA bundle variables.

RED->GREEN: tests/test_session_entries.py failed before build_sandbox_environment existed; now 5 passed. Full suite: 181 passed, 2 warnings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sub-agent terminal sessions don't inherit proxy environment

1 participant