Commit Graph
33 Commits
Author SHA1 Message Date
rustdeskandClaude Opus 5 68dcbe6adc cap the message an unauthenticated peer can make us hold
A frame header declares its own length, and until a connection authorizes nothing
bounded that length but the transport's ceiling: 1 GiB on TCP and on WebRTC, 64 MiB
on WebSocket. The decoder here already refuses to preallocate on a declared length,
so on TCP an attacker spends a byte sent per byte held; tungstenite does not, and
reserves a frame's whole declared payload the moment it passes max_frame_size, so a
fourteen-byte header buys 16 MiB. That is CVE-2021-32675's shape, and Redis answered
it the same way: a bound that holds only until the peer has authenticated.

`Stream::set_max_packet_length` carries such a bound to whichever transport is under
it. TCP has the knob already. WebRTC gains one: its reassembly ceiling moves from a
constant to a per-stream atomic, shared by every clone because the receive path runs
off one, and clamped to that constant so the send path's check still describes what a
peer will accept. WebSocket reaches tungstenite's own config, which needs a fork -
upstream exposes get_config and no set_config, at v0.26.2 and still at 0.30.0 - and
moves both bounds: max_frame_size is what stops a header from buying an allocation,
max_message_size is what bounds reassembly. Every transport clamps to its own
ceiling, so usize::MAX restores exactly what was there and no caller can raise one
above what it always had.

Nothing here calls it, so on its own this changes no behaviour.

Tests cover both new paths: the codec takes a header at the cap and dies on the one
a byte above it, before any payload is buffered; and a WebRTC loopback pair whose
receiver has lowered its bound refuses an oversize message, while the sender, whose
own bound is untouched, still puts it on the wire the way an unauthenticated peer
would.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZ49AbZJYfm8NTp5yDPMab
2026-09-17 11:59:52 +08:00
rustdeskandClaude Opus 5 e6fe9c3332 move the modules only rustdesk uses out to the base crate
hbb_common is shared with the server, but `fs`, `platform`, `keyboard`,
`message.proto` and most of `config::keys` are reached only from the client.
Keeping them here means every change to them costs a submodule round-trip.

They move to the new `base` crate in the rustdesk tree. What stays is
what the server actually names: `rendezvous.proto`, the socket/stream layer, the
`Config` core, and the 32 option keys this crate reads itself. Those 32 are
re-exported from `base::config::keys`, so callers still see one set.

`IdPk` moves from message.proto to rendezvous.proto. It is register-pk handshake
business, the server is its only other user, and the field numbers are unchanged
so the wire format is identical.

`config::patch()` resolves a home directory through the shell lookup that lived
in `platform::linux`, so `find_cmd_path`, `CMD_*` and `run_cmds_trim_newline`
stay behind in a new `sh` module. `base::platform::linux` re-exports
them, leaving every existing `platform::linux::CMD_SH` path working.

backtrace, filetime, osascript, smithay-client-toolkit and winapi go with the
code that used them, so the server no longer builds a Wayland client toolkit and
a Windows API crate it never calls.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZ49AbZJYfm8NTp5yDPMab
2026-09-08 08:53:58 +08:00
rustdeskandClaude Fable 5.1 00f0a720b5 webrtc: decode TURN userinfo before handing it to the ICE agent
`Url` returns the username and password percent-encoded, and they went
into the ICE server configuration as-is, so a password containing `@`,
`/`, `?`, `#`, `%` or a space (written encoded, the only way the URL can
carry it) failed the long-term credential check with a 401 and TURN
never produced a relay candidate. Decode both, as the web client does.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JXJJGEGdgu26wgCppvUXdZ
2026-09-04 23:34:08 +08:00
rustdeskandClaude Fable 5 59ce36f606 docs: webrtc 0.13 MSRV pin rationale and upgrade checklist
- Cargo.toml: record why webrtc is pinned to 0.13 — >=0.14 pulls sdp 0.10 /
  webrtc-util 0.12 using usize::is_multiple_of (needs rustc >=1.87), while
  rustdesk CI builds with Rust 1.75 (sciter i128 ABI pin)
- module-level upgrade checklist in src/webrtc.rs listing the version-coupled
  webrtc-rs internals this transport relies on (SCTP write backpressure,
  64KB message cap, detach() semantics, handler-capture leak cycle,
  Disconnected transience, stats-based is_relayed), all verified against
  webrtc 0.13 / webrtc-data 0.11 / webrtc-sctp 0.12
- send_bytes: document the bounded-backpressure mechanism (128 KiB PendingQueue
  semaphore + cwnd/rwnd cap) and that it is NOT cancel-safe

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-04 23:33:31 +08:00
rustdeskandClaude Opus 4.8 e9cdb2fe5d feat: WebRTC data-plane framing, DTLS binding, and pc-leak fixes
- 1-byte-header fragmentation past the 64KB SCTP cap; empty-message and clean-EOF handling
- is_relayed() via selected candidate-pair stats for the direct/relayed flag
- IdPk.dtls_fingerprint + rendezvous webrtc SDP/IceCandidate proto fields
- fix pc leaks: Weak capture breaks the state-handler Arc self-cycle; close pc on new() error paths

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-09-04 23:33:31 +08:00
Mariano Abad 6e27672774 refactor: move the socket probe to its own file behind a feature
Addresses the maintainer's two requests on #580: linux.rs was crowded,
and the new fallback should not touch the base Wayland path.

All the socket-probe machinery moves to src/platform/linux/wayland_probe.rs
- the child entry point, the runtime-dir scan, the privilege drop, the
process-group probe and its buffered-line inspection - leaving
WaylandDisplayInfo and get_wayland_displays in linux.rs. The module and
the fallback call in get_wayland_displays are gated on a new off-by-default
feature 'wayland_probe'; without it get_wayland_displays returns the
connect error exactly as it did before this fallback existed, so a
consumer that does not build the DRM login-screen backend compiles none
of this. The DRM build turns the feature on through scrap/drm.
2026-08-12 01:48:27 -03:00
fufesou 1f5ec1219f refact(crate): libloading x11
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-01-21 11:09:44 +08:00
fufesou 6df5c2c0ce feat: linux, get_home_trusted
Signed-off-by: fufesou <linlong1266@gmail.com>
2025-12-22 23:18:35 +08:00
RustDesk 3e1e58747a Update Cargo.toml 2025-11-13 22:15:04 +08:00
lichon 7f1941332b Merge branch 'rustdesk:main' into main 2025-11-13 21:00:36 +08:00
lc 8ae4651bc7 make webrtc-rs optional feature 2025-11-13 16:53:07 +08:00
fufesou 4fe91763b7 fix: Wayland resolution
1. Add filed `scale` in `message SwitchDisplay`(`message.proto`).
2. Add new function to get all display info.
3. Add help link of KDE Plasma Wayland.

Signed-off-by: fufesou <linlong1266@gmail.com>
2025-11-12 23:16:04 +08:00
lc 442160d704 add webrtc stream 2025-11-12 19:46:55 +08:00
fufesou 2985cd84b6 refact: update crate webpki-roots
Signed-off-by: fufesou <linlong1266@gmail.com>
2025-11-02 23:15:26 +08:00
fufesou ae7f2b2c9d fix: crate version, webpki-roots
Signed-off-by: fufesou <linlong1266@gmail.com>
2025-11-02 23:05:08 +08:00
fufesou ccb2214a0e refact: env logger, filter modules
Signed-off-by: fufesou <linlong1266@gmail.com>
2025-11-02 22:56:25 +08:00
fufesou 54c4d869ed refact: tls native-tls fallback rustls-tls
Signed-off-by: fufesou <linlong1266@gmail.com>
2025-10-31 12:37:23 +08:00
21pages bbc8e2f31a add mobile fallback platform verifier
Signed-off-by: 21pages <sunboeasy@gmail.com>
2025-10-30 13:13:04 +08:00
RustDesk 84a13ad7f3 Revert "mobile wss use rustls_platform_verifier" 2025-10-30 10:27:55 +08:00
21pages bf9a79fda5 mobile wss use rustls_platform_verifier
Signed-off-by: 21pages <sunboeasy@gmail.com>
2025-10-27 10:29:26 +08:00
RustDesk 78facdf759 revert flex log 2025-06-11 01:02:18 +08:00
RustDesk df95f44499 more udp punch 2025-06-10 12:01:43 +08:00
RustDesk b69b097c6f kcp stream 2025-06-03 19:41:30 +08:00
21pages 585bd1f152 websocket
Signed-off-by: 21pages <sunboeasy@gmail.com>
2025-05-08 18:20:38 +08:00
RustDesk 368dc1ab56 Update Cargo.toml 2025-04-30 20:51:38 +08:00
fufesou 8c2381278b fix: build
Signed-off-by: fufesou <linlong1266@gmail.com>
2025-04-30 20:35:44 +08:00
fufesou 8e1dd7f88f feat: hostname as id
Signed-off-by: fufesou <linlong1266@gmail.com>
2025-04-30 12:50:22 +08:00
YinMo19 512f67f25e [merge] merge conflict 2025-04-24 22:34:44 +08:00
YinMo19 c156d2eef7 [enhance] websocket 2025-04-17 11:42:58 +08:00
RustDesk 9e4b3f9696 Update Cargo.toml 2025-04-14 12:00:55 +08:00
RustDesk 5cc7db2676 Update Cargo.toml 2025-04-14 11:40:10 +08:00
RustDesk a26f25a045 tokio 1.44 2025-04-13 23:39:02 +08:00
21pages 49c6b24a7a init
Signed-off-by: 21pages <sunboeasy@gmail.com>
2025-01-20 16:06:27 +08:00