fix(security): prevent PATH hijack of supervisor helpers#1115
Draft
fix(security): prevent PATH hijack of supervisor helpers#1115
Conversation
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
Signed-off-by: Drew Newberry <anewberry@nvidia.com>
6 tasks
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
Hardens Docker sandbox supervisor startup against user-controlled
PATHoverrides and routes local Docker sandbox callbacks over a managed Docker bridge network instead of host-based routing. Docker now reasserts a driver-ownedPATHafter merging template/spec env, resolves Linux namespace helpers only from fixed absolute system paths, and advertiseshost.openshell.internal:<gateway-port>inside Docker containers.The Docker driver informs the gateway when native Linux Docker needs an extra bridge-gateway listener on the normal gateway port. Docker Desktop is different: its bridge gateway IP belongs to Docker Desktop's VM, not the macOS/Windows host, so Docker sandboxes use Docker's
host-gatewayalias forhost.openshell.internaland do not request an extra listener. The gateway listener also now defaults to127.0.0.1; container deployments pass--bind-address 0.0.0.0explicitly.Related Issue
Fixes #1113
Linear: https://linear.app/nvidia/issue/OSGH-151/bug-path-override-can-hijack-privileged-ip-and-nsenter-helpers
Changes
PATHdriver-owned after user environment merge.ipandnsenterhelpers from fixed absolute path allowlists instead of processPATH.--docker-network-name/OPENSHELL_DOCKER_NETWORK_NAME.host-gatewaymapping forhost.openshell.internalinstead of overriding it to the VM bridge gateway IP.OPENSHELL_ENDPOINTathost.openshell.internal:<gateway-port>.--bind-address/OPENSHELL_BIND_ADDRESS, defaulting to loopback, with Docker/Helm deployments explicitly binding0.0.0.0.PATHoverride attempts, helper-path lookup behavior, Docker bridge gateway parsing, Docker Desktop routing, loopback bind defaults, and multi-listener gateway binding.Testing
mise run pre-commitpassesAdditional targeted checks:
cargo test -p openshell-driver-dockercargo test -p openshell-server gateway_listener_addressescargo check -p openshell-server -p openshell-driver-dockeropenshell sandbox create --name desktop-routing-final --no-keep --no-tty -- trueagainst Docker Desktop gatewaydocker inspectconfirmed Docker Desktop containers useExtraHosts=["host.openshell.internal:host-gateway"]lsof -nP -iTCP:18080 -sTCP:LISTENconfirmed the local Docker gateway listens on127.0.0.1:18080cargo test -p openshell-sandbox find_trusted_binary(macOS host compiles crate but Linux-only tests are filtered)cargo zigbuild -p openshell-sandbox --target aarch64-unknown-linux-gnucargo zigbuild -p openshell-sandbox --target aarch64-unknown-linux-gnu --testsChecklist