mirror of
https://github.com/rustdesk/rustdesk-server.git
synced 2026-08-27 04:28:08 +00:00
This commit is contained in:
Generated
+2320
-256
File diff suppressed because it is too large
Load Diff
@@ -401,6 +401,15 @@ async fn make_pair(
|
||||
use tokio_tungstenite::tungstenite::handshake::server::{Request, Response};
|
||||
let callback = |req: &Request, response: Response| {
|
||||
let headers = req.headers();
|
||||
// X-Real-IP / X-Forwarded-For are trusted as-is so that the real
|
||||
// client IP is preserved when the WebSocket port runs behind a
|
||||
// reverse proxy (WSS). They are NOT validated: anyone who can reach
|
||||
// this port directly can spoof an arbitrary IP, bypassing IP-based
|
||||
// rate limiting / blocking and corrupting logged IPs. Do not expose
|
||||
// the WebSocket port directly to untrusted networks; only the
|
||||
// reverse proxy, which overwrites these headers, should be able to
|
||||
// connect to it.
|
||||
// https://github.com/rustdesk/rustdesk-server/issues/634
|
||||
let real_ip = headers
|
||||
.get("X-Real-IP")
|
||||
.or_else(|| headers.get("X-Forwarded-For"))
|
||||
|
||||
@@ -1153,6 +1153,15 @@ impl RendezvousServer {
|
||||
use tokio_tungstenite::tungstenite::handshake::server::{Request, Response};
|
||||
let callback = |req: &Request, response: Response| {
|
||||
let headers = req.headers();
|
||||
// X-Real-IP / X-Forwarded-For are trusted as-is so that the real
|
||||
// client IP is preserved when the WebSocket port runs behind a
|
||||
// reverse proxy (WSS). They are NOT validated: anyone who can reach
|
||||
// this port directly can spoof an arbitrary IP, bypassing IP-based
|
||||
// rate limiting / blocking and corrupting logged IPs. Do not expose
|
||||
// the WebSocket port directly to untrusted networks; only the
|
||||
// reverse proxy, which overwrites these headers, should be able to
|
||||
// connect to it.
|
||||
// https://github.com/rustdesk/rustdesk-server/issues/634
|
||||
let real_ip = headers
|
||||
.get("X-Real-IP")
|
||||
.or_else(|| headers.get("X-Forwarded-For"))
|
||||
|
||||
Reference in New Issue
Block a user