-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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 extra security for hosts #5836
base: main
Are you sure you want to change the base?
Conversation
approved_hostnames: list[str] = field( | ||
default_factory=lambda: ['localhost', '127.0.0.1'] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not rely on the uvicorn
--host
flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The uvicorn host flag is currently set to 0.0.0.0
by the default docker command (so that the server is accessible from outside the docker container). This means that unless docker is firewalled, anything within is it accessible on any network on which the machine is running. So, for example, if a person was running on a wifi hotspot at an internet cafe, somebody at a nearby table could access their server and use their LLM credits assuming there were not other security precautions in place and that they could figure out the IP (Maybe just search the subnet for an open port 3000). Or if somebody did not secure their home WIFI correctly, then their neighbor may be able to use their LLM credits.
By default, disallowing access to server by any domain except localhost
I figure the LLM API key is the
crown jewels
of what an intruder would want to steal / exploit with openhands. (Assuming they can't figure a way to escape the docker sandbox).We recently changed over from using local storage to save config including API keys to using a server side settings store. Given that the stock openhands version has no concept of users or authentication, we need to prevent access to it by default from any domain except localhost. Although the LLM keys cannot be retrieved, sessions could be created by any remote machine with network access - since docker is not firewalled by default on mac at least:
After this change:
To run this PR locally, use the following command: