mirror of
https://github.com/open-webui/open-webui.git
synced 2026-03-10 07:43:10 -05:00
feat: Add CORS validation to WebSocket connections #6701
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 @ricdikulous on GitHub (Oct 18, 2025).
Check Existing Issues
Problem Description
Open WebUI's WebSocket server does not enforce CORS (Cross-Origin Resource Sharing) origin validation on WebSocket connections. While WebSocket endpoints are protected by authentication mechanisms, they lack the same origin validation that HTTP endpoints have.
Without CORS validation on WebSockets, there's a potential attack vector for Cross-Site WebSocket Hijacking (CSWSH), where a malicious website could attempt to establish WebSocket connections if it somehow obtains valid authentication tokens (e.g. through XSS on a different subdomain, browser extensions, or other token leakage scenarios).
This is a defense-in-depth concern rather than an immediate vulnerability, but it represents a gap in the security layers that should be addressed for consistency and best practices.
Desired Solution you'd like
Add CORS origin validation to the WebSocket server configuration by utilizing the existing
CORS_ALLOW_ORIGINenvironment variable that's already used for HTTP endpoints.Alternatives Considered
Leave as is
Additional Context
This was raised while we had a team do a thorough security review of Open WebUI