Repository navigation
fix(agent): listen on the guest's address, not every interface - #431
Merged
Merged
Conversation
The host reaches the agent at the address the guest was booted with, so it binds that, read from the kernel's ip= argument, and loopback when there is none. Code inside the sandbox can still reach it, so this narrows what is exposed and is not a boundary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: WaylandYang <145302500+WaylandYang@users.noreply.github.com>
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.
The last open CodeQL alert on
dev,py/bind-socket-all-network-interfacesinsandstorm-agent.py: a Firecracker guest's agent listened on0.0.0.0:8888.The host reaches it at the guest's address, so it now binds that, read from the kernel's
ip=argument, and127.0.0.1when there is none. The address is not hard-coded here:firecracker.rsdecides it, and a boot without a network has noip=.This is not a boundary. The agent runs commands without a credential, and code inside the sandbox can still reach it at
10.42.0.2:8888. Nothing outside the guest could reach it any other way before this either: the guest hasloandeth0, and the namespace's rules forward to the guest. This narrows what is exposed by loopback, and closes the alert.bind_addressis covered by new tests inrootfs-init/tests/test_agent_env.py.Testing
On Firecracker on bare metal, with a template pulled through
from-image, so it carries this agent:/proc/net/tcpinside the guest shows the listener on10.42.0.2only.execworks after a cold boot, after a branch, in a fork of that tag, and back from frozen and from on disk.test_agent_env.py23 of 23, plustest_agent_stream.pyandtest_agent_app.pypass on macOS.scripts/dev/e2b-sdk.pywas not run: it does not use this agent's port. gVisor does not run this agent.Existing Firecracker templates keep the agent they were built with until they are rebuilt.
🤖 Generated with Claude Code