Commit Graph

354 Commits

Author SHA1 Message Date
rustdesk 64b54abea3 proto: webrtc_all_ice — full-ICE offers under transport-forced relay
use_ws() folds into force_relay because a ws tunnel kills classic TCP/UDP
punching — but ICE opens its own sockets and does not care how signaling
reaches the server. Without a signal, the controlled side must treat every
force_relay offer as Relay-only ICE (answer gated on TURN), which locks
WebSocket deployments out of direct WebRTC entirely.

webrtc_all_ice marks an offer that gathered every candidate type: the
controller's force_relay covers only classic punching, not ICE policy.
Absent/false keeps today's semantics on every skew combination (old
controller, old server dropping the field, old controlled side).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ExUfAkYbq8UC9pQCiLy8TQ
2026-08-07 00:11:03 +08:00
rustdesk cdcfd8db1f proto: drop the reserved tag in PunchHole
`requester_id = 11` was added and removed in the same rebase batch, never
reached main, and never reached hbbs — whose vendored copy of this file still
stops at field 9. So nothing has ever written or read tag 11, and reserving it
guards a wire format that does not exist.

It was also inconsistent with what this branch already does: `IceCandidate`
retyped tag 2 from `string to_id` to `bytes socket_addr` in place, which is only
sound because none of this proto has shipped. Same premise, so tag 11 is free.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-06 15:21:27 +08:00
rustdesk 9ea5442310 fix(webrtc): reject malformed fragment framing, correct receive-path docs
`next()` read every non-FRAG_END header as "more fragments", so a peer whose
framing had diverged was only caught by the MAX_FRAME_LENGTH cap — and a
FRAG_MORE carrying no payload was never caught at all: it adds nothing to the
accumulator, so the cap never trips and the loop spins for as long as the peer
keeps writing, with no error and no teardown. Decide the header's meaning in one
match, so a future header kind cannot be handled in one place and missed in the
other. Neither case is reachable from send_bytes_inner, which emits FRAG_MORE
only for a full MAX_FRAGMENT_PAYLOAD chunk.

Release the accumulator on the error paths rather than truncating it: at the cap
that is ~1 GiB still referenced through the SESSIONS clone.

Doc corrections, all of them overclaims in the previous pass:

- the cancel-safety entry held only for the successful read path.
  read_data_channel does await after dequeuing on its ErrShortBuffer and DCEP
  branches, and next() awaits pc.close() on its error paths — where
  RTCPeerConnection::close latches is_closed before its first await, so a
  cancelled close silently turns every later close into a no-op and leaves the
  pc in SESSIONS.
- recv_state: cancellation drops the guard mid-message, so it is the
  single-reader assumption, not the mutex, that ultimately keeps two readers
  from splicing into one accumulator.
- is_relayed: stream.rs promised None before pair selection while webrtc.rs
  documented Some(true) under Relay policy; align both.
- get_local_endpoint: examples/webrtc.rs calls it too, not only the tests.
- PunchHole.reserved 11: named the wrong writer — PunchHole is written by the
  rendezvous server, not by peers. Reserve the name as well as the tag.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-06 14:45:00 +08:00
rustdesk b7f79c6954 fix: cap the log file by size, and keep LogThrottle usable after poisoning
Rotating on age alone let a single day's file grow without limit, so whoever
can drive a hot log site decided how much disk this uses and no amount of
per-site throttling could bound it. Add a size criterion, which covers every
call site at once — including ones no throttle was added to.

LogThrottle: recover the guard on a poisoned lock rather than returning None.
Poisoning only means another thread panicked while holding it; the guarded
data is two counters that are still usable, and going silent for the rest of
the process is worse than a stale count. AGENTS.md permits handling lock
poisoning directly, and it forbids swallowing the error.

Keep map_or over clippy's is_none_or: that was stabilized in Rust 1.82 and CI
pins 1.75.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ExUfAkYbq8UC9pQCiLy8TQ
2026-08-06 14:21:24 +08:00
rustdesk 9ec46d5cb3 feat: add LogThrottle for sites whose rate a peer controls
Debug output is written to the log file, so a log site that fires per received
message lets whoever is sending decide how much a machine writes to disk.
Dropping the line instead would hide real faults, so collapse it: one line per
interval carrying the count of everything suppressed since the last one, with
the first occurrence after a quiet period always reported so an isolated fault
is not delayed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ExUfAkYbq8UC9pQCiLy8TQ
2026-08-06 13:41:15 +08:00
rustdesk c58be3034d 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-08-05 19:24:51 +08:00
rustdesk e0307245dc fix: preserve WebRTC endpoint and send semantics 2026-08-05 19:24:51 +08:00
rustdesk 4c0e20fbbe 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-08-05 19:24:51 +08:00
rustdesk 95855416bc fix: route WebRTC ICE without requester id 2026-08-05 19:24:51 +08:00
rustdesk d53b0502f4 feat: support trickle ICE in WebRTCStream 2026-08-05 19:24:51 +08:00
rustdesk 507fc6e140 feat: add rendezvous WebRTC signaling fields 2026-08-05 19:24:51 +08:00
RustDesk 69cea8dafe Merge pull request #574 from FrederickStempfle/security/fix-aligned-buffer-layout
fix: preserve aligned allocation layout
2026-07-26 08:02:26 +08:00
FrederickStempfle 8eaff10bb3 fix: preserve aligned allocation layout 2026-07-25 15:04:08 +00:00
RustDesk 7ee389e8e3 Merge pull request #575 from FrederickStempfle/security/cap-zstd-decompression
fix: cap zstd decompression output
2026-07-25 18:24:35 +08:00
FrederickStempfle a1a701654f fix: cap zstd decompression output 2026-07-25 09:07:19 +00:00
RustDesk 559176122b Merge pull request #572 from 21pages/recording
feat(config): add recording visibility and service save path options
2026-07-24 17:09:21 +08:00
RustDesk 6ba2006f33 Merge pull request #573 from fufesou/refact/fs-expose-fn-validate-path
Refact/fs expose fn validate path
2026-07-24 17:08:35 +08:00
fufesou d8b5a2fd3b Merge branch 'main' into refact/fs-expose-fn-validate-path 2026-07-24 10:39:48 +08:00
fufesou 70949becf6 fix: expose validated path join 2026-07-24 10:20:10 +08:00
21pages 21fb4e30ae feat(config): add recording visibility and service save path options
- add hide-recording-button to local settings
  - add windows-service-video-save-directory to service settings

Signed-off-by: 21pages <sunboeasy@gmail.com>
2026-07-23 21:43:19 +08:00
RustDesk 5438d20225 switch_code 2026-07-17 17:44:01 +08:00
RustDesk 4bfd067765 typo 2026-07-14 14:51:51 +08:00
RustDesk ba990f5b52 Update config.rs 2026-07-14 14:44:44 +08:00
RustDesk 7e1c392c62 Merge pull request #565 from fufesou/feat/option-allow-scope-violation
feat(option): allow scope violation close/alarm
2026-07-02 14:54:26 +08:00
fufesou d27a338f27 feat(option): allow scope violation close/alarm
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-07-01 17:19:24 +08:00
RustDesk a920d00945 Merge pull request #559 from 21pages/audit_controller_user
Add controlled context for controller audit attribution
2026-06-26 14:22:33 +08:00
21pages 91b13be6fd Add controlled context for controller audit attribution
Add ControlledContext to rendezvous messages so the server can pass a controller-user audit ref to the controlled client.

The controlled client returns the ref when posting audit logs, allowing the server to associate those logs with the controller user.

Signed-off-by: 21pages <sunboeasy@gmail.com>
2026-06-26 14:16:56 +08:00
RustDesk 387603f47c Merge pull request #551 from 21pages/improve_ws_redirect_error_message
Improve WebSocket redirect error message
2026-06-04 09:51:20 +08:00
21pages f1889f6477 Improve WebSocket redirect error message
Signed-off-by: 21pages <sunboeasy@gmail.com>
2026-06-03 15:52:15 +08:00
RustDesk df6badca5b Merge pull request #548 from fufesou/fix/bytes-codec-reserve-check-max
fix: bytes codex, avoid unlimit reserve()
2026-06-01 18:05:13 +08:00
fufesou 547da54b4e fix: bytes codex, avoid unlimit reserve()
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-06-01 12:17:37 +08:00
RustDesk e50ac3cd48 Merge pull request #546 from fufesou/fix/symmetric-crypt-compatibility
fix(crypt): symmetric crypt compatibility
2026-06-01 11:33:25 +08:00
fufesou 82ce6e7327 fix(crypt): avoid plain
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-31 13:20:48 +08:00
fufesou 14632284d7 fix(crypt): symmetric crypt compatibility
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-31 11:52:46 +08:00
RustDesk 4d8af61d5c Merge pull request #545 from fufesou/fix/symmetric-crypt-nonce
fix(security): add nonce to local symmetric encryption
2026-05-30 17:50:23 +08:00
fufesou 10b354456d fix(security): symmetric nonce, update unit tests
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-29 16:07:00 +08:00
fufesou f1b2da51b7 fix(pin): keep pin if unchanged
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-29 15:32:16 +08:00
fufesou e1bdb06565 fix(security): add nonce to local symmetric encryption
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-28 20:17:28 +08:00
RustDesk 2e9f641101 Merge pull request #544 from 21pages/allow-command-line-settings-when-settings-disabled
option allow-command-line-settings-when-settings-disabled
2026-05-28 17:22:28 +08:00
21pages 24f430b384 option allow-command-line-settings-when-settings-disabled
Signed-off-by: 21pages <sunboeasy@gmail.com>
2026-05-28 11:44:41 +08:00
RustDesk 822701e416 Merge pull request #540 from fufesou/refact/password-encrypt
refact(password): encrypt
2026-05-23 17:43:34 +08:00
fufesou 728b73d540 refact(password): rename and comments 2026-05-23 15:13:16 +08:00
fufesou ce1f7b5f9a refact(password): clear password, do not clear salt
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-23 14:43:43 +08:00
fufesou 73ab2c37ae refact(password): do not auto migrate to version 01
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-22 21:32:33 +08:00
fufesou 2f032ad525 refact(password): early return error on invalid password
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-22 18:53:02 +08:00
fufesou 8e0c8ab939 refact(password): simplify
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-21 15:04:32 +08:00
fufesou 9e00fa2762 refact(password): check invalid with 01 when set salt
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-20 18:26:18 +08:00
fufesou 0c218232d1 refact(password): set cfg, do not early return if the password is invalid
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-20 17:27:27 +08:00
fufesou f94992f6ca refact(password): simplify preset password
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-20 16:57:16 +08:00
fufesou e7af2e8488 trivial changes
Signed-off-by: fufesou <linlong1266@gmail.com>
2026-05-20 14:32:54 +08:00