fix: accept terminal sockets from the page host

The origin check compared the browser's Origin with the configured
public_url. Reaching the app through localhost or another LAN address
then rejected the terminal and presence sockets even though the page
and the socket were on the same origin.

Compare the Origin authority with the request's Host header instead.
That is the address the browser actually used, so the check still
refuses another site while working behind a proxy and on every local
address.
This commit is contained in:
vhaudiquet committed 2026-11-28 02:18:22 +01:00
1 parent d7aa268ae0
commit be04a6cf90
3 files changed
+61 -12

No files matched your search

+1 -1
View File
@@ -237,7 +237,7 @@ pub async fn terminal(
headers: HeaderMap,
ws: WebSocketUpgrade,
) -> AppResult<Response> {
if !super::websocket_origin_ok(&state.config, &headers) {
if !super::websocket_origin_ok(&headers) {
return Err(AppError::forbidden("websocket origin does not match"));
}
member_of(&state, &room, &user.user.id)?;