Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding sandbox property runtime_binding_address to specify whic… #6992

Merged
merged 2 commits into from
Feb 28, 2025

Conversation

fredysierra
Copy link
Contributor

specify which network interface on the host machine Docker should bind the runtime ports to

  • This change is worth documenting at https://docs.all-hands.dev/
  • Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

End-user friendly description of the problem this fixes or functionality that this introduces.

Runtimes are exposing some ports by default to all your network interfaces.

image

From security perspective and reduce attack surface. It is better if those ports are exposed only in the localhost 127.0.0.1. It should be able to configure the binding address for the runtime ports. It will specifies which network interface on the host machine Docker should bind the runtime ports to.


Give a summary of what the PR does, explaining any non-trivial design decisions.
New sandbox configuration property was introduced runtime_binding_address default value is 127.0.0.1
image


Link of any specific issues this addresses.
https://github.com/All-Hands-AI/OpenHands/security/advisories/GHSA-jh54-cg39-w6pq

…h network interface on the host machine Docker should bind the runtime ports to
@@ -60,6 +61,7 @@ class SandboxConfig(BaseModel):
default=False
) # once enabled, OpenHands would lint files after editing
use_host_network: bool = Field(default=False)
runtime_binding_address: str = Field(default='127.0.0.1')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default is 0.0.0.0 so this could be a breaking change. But agreed 127 is safer...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah.. you are right. It would be a breaking change but it is safer. As it is a breaking change do I have to change something to the PR or description to make it clear?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to validate that core functionality still works with this change (e.g. asking the agent to start an app), but need to get a docker image built...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mamoodi can you have a look at this one?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rbren I made the changes in #7017 and tested:

  • Accessing VS Code
  • Downloading workspace
  • Running a server shows up in App tab

They all are good on Mac.
Should I test this on Ubuntu and Windows as well?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! OK let's get this in

@@ -60,6 +61,7 @@ class SandboxConfig(BaseModel):
default=False
) # once enabled, OpenHands would lint files after editing
use_host_network: bool = Field(default=False)
runtime_binding_address: str = Field(default='127.0.0.1')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! OK let's get this in

@rbren rbren merged commit 2b3c38d into All-Hands-AI:main Feb 28, 2025
23 checks passed
adityasoni9998 pushed a commit to adityasoni9998/OpenHands that referenced this pull request Mar 3, 2025
@mamoodi
Copy link
Collaborator

mamoodi commented Mar 8, 2025

Unfortunately, it seems this PR has started to cause issues on some people's systems.
#7152

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.

3 participants