mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[GH-ISSUE #8998] More secure defaults: Disable CORS, and only bind to localhost #15351
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @joliss on GitHub (Jan 27, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8998
CORS
If I understand the CORS warning below correctly, open-webui by default allows CORS requests from any origin. I might misunderstand and it actually has an additional security layer that stops misuse of this, but at first blush, this seems like something I definitely don't want, since it might allow any website that I'm opening in my browser to send CORS requests to localhost:8080 to download my chat history or run LLM requests.
I figured out that
CORS_ALLOW_ORIGIN=http://localhost open-webui serveprobably disallows CORS from non-localhost origins. (I first triedCORS_ALLOW_ORIGIN= open-webui serve, but it crashed.)Perhaps the UX and security could be improved by having CORS disallowed by default, and only allow it if CORS_ALLOW_ORIGIN is explicitly set. (For reference, CORS_ALLOW_ORIGIN seems to have been added in #4714, but it doesn't seem to have changed the default behavior to be more secure.)
Default bind
According to
open-webui serve --help, the default host to bind to is0.0.0.0, which allows anyone on the internet to connect to my server.I would suggest that
localhostis a more secure default. Anybody who wants their server to be reachable via any or all network interfaces can explicitly set--hostto do so.Note: I'm not familiar with how Docker manages incomes network connections and how this change might affect Docker. If we change this default, it might be worth checking
0.0.0.0, but rather also useslocalhostas a secure default.Changing the default behavior for CORS and bind is probably a breaking change, so I would suggest bumping the major version (e.g. to 0.6.0) with this change.