You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: add regression coverage for proxy hostname parser differentials #1498
Add regression tests that exercise hostname parser/canonicalization edge cases at the sandbox proxy boundary. This is inspired by the Claude Code SOCKS5 NUL-byte allowlist bypass documented here:
The core class is a parser differential: policy matching approves one hostname representation while the resolver/connect path dials a different destination. OpenShell does not appear to share the specific SOCKS5 NUL-byte issue, but the class is worth pinning down in tests.
Definition of Done
Add focused regression coverage for malformed CONNECT hostnames, including NUL/control characters and encoded variants.
Include wildcard policy cases so policy matching and resolution are exercised together.
Confirm internal-IP/SSRF checks still fail closed for malformed or ambiguous destinations.
Issue type:chore Complexity: Low Confidence: High — clear path
Summary
Add focused regression tests for hostname parser/canonicalization edge cases in the sandbox proxy path. The tests should document the parser-differential class from the referenced Claude Code SOCKS5 NUL-byte bypass and verify OpenShell continues to fail closed across policy matching, wildcard hosts, DNS resolution, and SSRF/internal-IP checks.
Scope
crates/openshell-sandbox/src/proxy.rs: add unit tests around CONNECT target parsing and resolver/SSRF helper behavior for malformed or ambiguous hostnames.
crates/openshell-sandbox/src/opa.rs: add or extend wildcard-host policy tests for NUL/control/encoded-style hostname inputs, ensuring policy matching does not create an unintended allow path.
Implementation Steps
Add parser-focused unit tests for CONNECT targets containing NUL/control characters, percent-encoded NUL-like input, empty hosts, and oversized hosts.
Add wildcard policy tests that exercise malformed hostname inputs against *.example.com style rules.
Add resolver/SSRF helper assertions that malformed or ambiguous destinations fail before an upstream connection can be established.
Keep the implementation test-only unless the tests reveal a concrete fail-open behavior that requires a small validation fix.
Test Plan
Unit tests:cargo test -p openshell-sandbox <focused filters> --lib covering proxy parser, OPA wildcard matching, and resolver/SSRF behavior.
Integration tests: N/A — this is regression coverage for existing module boundaries.
E2E tests: N/A — no sandbox infrastructure or user workflow changes expected.
Risks & Open Questions
If a test exposes permissive behavior in parse_target, decide whether to make this issue include the small fail-closed validation fix or split that into a separate fix ticket. Given the security context, a minimal validation fix would likely be appropriate if needed.
Documentation Impact
None expected. This is internal regression coverage; no user-facing behavior change is intended unless a validation gap is found.
This issue is valid for OpenShell because it is a focused sandbox security/testing item with maintainer-authored scope and an active linked PR (#1562).
Recommended next step: track the linked PR through review and CI.
This issue has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity. Comment or remove the state:stale label to keep it open.
Activity
zredlined commentedon May 21, 2026
Implementation Plan
Issue type:
choreComplexity: Low
Confidence: High — clear path
Summary
Add focused regression tests for hostname parser/canonicalization edge cases in the sandbox proxy path. The tests should document the parser-differential class from the referenced Claude Code SOCKS5 NUL-byte bypass and verify OpenShell continues to fail closed across policy matching, wildcard hosts, DNS resolution, and SSRF/internal-IP checks.
Scope
crates/openshell-sandbox/src/proxy.rs: add unit tests around CONNECT target parsing and resolver/SSRF helper behavior for malformed or ambiguous hostnames.crates/openshell-sandbox/src/opa.rs: add or extend wildcard-host policy tests for NUL/control/encoded-style hostname inputs, ensuring policy matching does not create an unintended allow path.Implementation Steps
*.example.comstyle rules.Test Plan
cargo test -p openshell-sandbox <focused filters> --libcovering proxy parser, OPA wildcard matching, and resolver/SSRF behavior.Risks & Open Questions
parse_target, decide whether to make this issue include the small fail-closed validation fix or split that into a separate fix ticket. Given the security context, a minimal validation fix would likely be appropriate if needed.Documentation Impact
Revision 1 — initial plan
fix(tests): Add hostname parser security regression tests (NVIDIA#1498)
johntmyers commentedon Jun 3, 2026
Validated
This issue is valid for OpenShell because it is a focused sandbox security/testing item with maintainer-authored scope and an active linked PR (#1562).
Recommended next step: track the linked PR through review and CI.
github-actions commentedon Jun 19, 2026
This issue has had no activity for 14 days and is now marked stale. It may be closed in 7 days if there is no further activity. Comment or remove the state:stale label to keep it open.