Repository navigation
feat(web-client): authorize browser sessions and add read-only TCP diagnostics - #393
yardbirds0 wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
f4af410 to
468b51d
Compare
|
Hey @YuZhiYuanDev, the browser remote control work is ready for review now, along with the frontend PR. It’s a pretty big change and still needs more real-world testing, so it’s beta for now. It’s usable, but the feature set is still fairly basic, and getting everything into good shape will take time and continued testing. The foundation is in place now, though, and we can gradually build on it and improve it together. |
This browser remote-control feature is usable in the desktop configurations tested so far, but it is still experimental and not fully polished. Broader compatibility, long-session reliability, and some interactions need more work. Community testing, review, and contributions are welcome so we can improve it together.
Summary
Adds the authorization, session lifecycle, transparent WebSocket gateway, audit integration, and read-only network diagnostics needed by the companion browser client. The feature is disabled by default. This replaces the previous incremental commits with one consolidated feature commit based on official
mainat630cdba399608b93a8ae6667f78bff995fd2b23c.Companion frontend: databk/rustdesk-console-web#351
Authorization and session lifecycle
web_client.connectweb_client.file_transfercovering the targetdevices.disconnectfor another user's sessionservers.viewThe system owner retains the existing owner bypass. Every ordinary user needs an explicitly assigned Web Client role permission, including for their own devices. Address-book visibility, device ownership, native ACLs, and
devices.viewdo not implicitly grant it. Global and device-group scopes apply equally to device selection and manually entered IDs. Unknown, disabled, out-of-scope, or ambiguously registered IDs are rejected. Existing native/api/peersACL behavior is preserved.Grants bind the actor, login JTI, registered device UUID/ID, server configuration, and desktop/file purpose. Two independent single-use tickets expire after 60 seconds; pending grants expire after 120 seconds, and active grants are bounded by eight hours and the login/parent expiry. Limits are eight grants per account and 256 per process. Current account, login, role, and device state are revalidated every 15 seconds with bounded validation deadlines. Revocation, expiry, cancellation, restart, and parent termination invalidate tickets and close the associated channels. Delayed results cannot revive closed sessions.
Gateway and security boundaries
/api/web-client/socketUpgrade route with an explicitly configured HTTPS Origin. Tickets travel in the first WS message, never URLs. Console JWTs are not sent to the Worker or native servers.The file role governs the supported independent file-channel flow. A transparent gateway cannot inspect all operations hidden inside an encrypted desktop stream; strict file/clipboard restrictions still require remote native permissions. Console roles also do not automatically govern publicly reachable native TCP/WS access.
Audit integration
Reuses
console_auditswith session/parent/target identifiers and explicit evidence sources. Admission/denial, relay opening, cancellation, administrative termination, revocation, expiry, and closure are server observations. Remote-authentication and file-transfer start/completion/failure reports are marked browser-sourced; they are not independent proof of remote execution or a guarantee of complete delivery.Audit data excludes passwords, derived credentials, JWT/JTI, tickets, clipboard/chat/file content, and keystrokes. File metadata is restricted to basename, size, and direction with strict schemas and rate/count limits. Admission fails closed if its required audit cannot be written. Termination closes resources before attempting audit persistence.
Existing server management and TCP information
Extends the existing server-management APIs rather than adding a new administration tab. Optional
SERVER_MANAGEMENT_LOCAL=1reuses the existing management core inside Console, allowing an explicitly configured four-container installation to retain real management without another agent container or host service. It requires enrolled/label-checked containers, native management endpoints, a private management token, and an explicitly mounted Docker socket. Existing permission guards and mutation audits remain in force. Docker access grants host-level administration capability and is an opt-in deployment choice.The official Docker non-root entrypoint now preserves UID 1000 while selecting the mounted socket's group only in that explicit mode. Missing sockets fail startup. Default deployments keep UID/GID 1000 and the private updater-state boundary.
TCP reads require no socket mount or helper for local system configuration. Linux namespace configuration, Windows templates, and supported macOS observations carry the actual reading scope and explicit failure reasons. System configuration is kept separate from actual connection observations. Session diagnostics independently report the final entry sender and hbbr relay sender; proxy/NAT/namespace/permission limitations return Unable to identify, without substituting a system default. No sysctl writes, module loading, algorithm selector, saved network preference, or additional network deployment remains.
Deployment and compatibility
Deploy with the companion frontend and explicit
WEB_CLIENT_*configuration. The HTTPS proxy must forward WebSocket Upgrade to Console and protect legacy/raw browser WS bypasses. Docker frontend routing is included; the existing native frontend HTTP proxy needs an outer proxy to route this exact WS path directly to Console. Preserve native TCP/UDP ports and keys. Grants are process-local: use one Console instance or consistent affinity between grant requests and sockets.The integration preserves upstream updater/bootstrap changes. Agent image build context includes the shared read-only collector. Documentation covers configuration, bypass protection, trust boundaries, scope, and rollback.
Validation
Local equivalents of official PR CI passed against the synchronized main baseline:
npm ci, full ESLint, TypeScript, and Nest build.Earlier paired real-device testing exercised authorization/revocation, native desktop/file authentication, media, transfers, recording, and administrative closure. That evidence is historical, not a claim that this final cleanup revision has completed every real-device matrix. No production deployment was performed for this final review.
Progress and remaining work
[████████░░] 8/10 review milestones completePlease keep this as a draft while the remaining compatibility and review work is completed.