Skip to content

Security: drive the LCD's browser through pipes on Windows, not a debugging port - #85

Merged
kleju13 merged 1 commit into
mainfrom
lcd-browser-pipes
Nov 14, 2026
Merged

kleju13 merged 1 commit into
mainfrom
lcd-browser-pipes

Conversation

@kleju13

@kleju13 kleju13 commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

What changes

The LCD's web mode runs a headless Edge or Chrome and drives it over DevTools. On Windows the browser listened for that on a port on 127.0.0.1. Every user and program on the PC could connect to it and drive a browser that runs as the signed-in user. On Linux camless already used two pipes. Now Windows does too, and no port is open.

  • Pipes on Windows. The browser gets --remote-debugging-pipe and takes the two pipes as inherited handles named in --remote-debugging-io-pipes. This needs Edge or Chrome 118 or newer. With an older one the mode says so.
  • The WebSocket client is gone from src/cdp.rs. Both systems share the message code. Windows reads the pipe on a thread, because an anonymous pipe has no read with a timeout.
  • A camless that runs as administrator still starts the browser as the signed-in user. CreateProcessWithTokenW, which it used until now, passes no handles on. So camless starts the browser as a child of Explorer, and then puts the security of the new process, its first thread and its token back to what Explorer's own children get: Windows writes all three from camless's administrator token otherwise.
  • docs/how-it-works.md has the new paragraph and what did not work, with the symptoms.

One thing to know: a program that starts a child under Explorer and edits its token's security may look odd to an antivirus. Microsoft Defender did not react on the test PC. No other product was tried.

Testing

  • cargo test --workspace --release --locked on Linux: 178, 36 and 25 tests pass. cargo test --workspace --locked for x86_64-pc-windows-gnu under Wine: 170, 36 and 27. New tests: messages split over several reads come out whole and in order, a closed pipe is an error and not a wait, and on Windows a child process gets both pipes and answers through them.
  • On a Windows 11 PC with Edge 157 and a Kraken Elite 2024 in web mode:
    • the service as administrator: Edge runs without administrator rights as a child of Explorer, with its GPU process and crash handler, the browser listens on no TCP port, and the LCD shows the page at about 10 frames a second;
    • camless lcd page URL without administrator rights renders the page, with the handles inherited directly.

Not tested: Chrome, a browser older than 118, a standard account.

AI agent on behalf of kleju13

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Browser debugging now uses pipe-based connections on Windows and Linux.
    • On Windows, elevated service launches can run the browser with the signed-in user’s permissions.
  • Bug Fixes
    • Improved handling of browser startup failures on Windows, including clearer exit information.
  • Documentation
    • Added setup details for Windows browser version requirements and pipe-based debugging, along with notes on unsuccessful launch approaches.

…ging port

The browser for the LCD's web page listened for DevTools on a port on
127.0.0.1, which every user and program on the PC could connect to. On
Windows camless now passes it two pipes (--remote-debugging-pipe with
--remote-debugging-io-pipes), as it already did on Linux. This needs
Edge or Chrome 118 or newer. The WebSocket client is gone.

CreateProcessWithTokenW passes no handles on, so a camless that runs as
administrator now starts the browser as a child of Explorer and puts
the new process's, thread's and token's security back to what
Explorer's own children get. Without that Edge could not start its
sandbox or its crash handler. docs/how-it-works.md records what did not
work.

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Walkthrough

Camless now uses Chrome DevTools Protocol pipes on Windows and Linux. Browser startup uses inherited pipes on Windows and applies Explorer-derived security settings for elevated launches.

Changes: Pipe-based DevTools connections

Layer / File(s) Summary
Pipe-based CDP messaging
src/cdp.rs
Cdp now sends commands through a pipe and reads NUL-delimited replies and events. Unix and Windows pipe readers handle timeouts and closed pipes. Tests cover split messages, ordering, timeouts, and closed pipes.
Cross-platform browser pipe startup
src/web.rs
Windows and Linux launch browsers with remote-debugging pipes. Startup sends Browser.getVersion and checks for a reply, process exit, stop request, or timeout. Windows early-exit errors include the exit code and browser version requirement.
Windows inherited pipes and process setup
Cargo.toml, src/web.rs, docs/how-it-works.md
Windows creates and transfers inherited pipe handles. For elevated launches, the browser starts as Explorer’s child, and Explorer-derived access and integrity settings are applied before the browser resumes. The dependency enables Windows pipe APIs, and the documentation describes the pipe setup and browser version requirement.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant BrowserLaunch
  participant SpawnPiped
  participant Chromium
  participant Cdp
  BrowserLaunch->>SpawnPiped: Start browser with remote-debugging pipes
  SpawnPiped->>Chromium: Pass inherited pipe handles
  SpawnPiped-->>BrowserLaunch: Return browser process and pipe-backed connection
  BrowserLaunch->>Cdp: Send Browser.getVersion
  Cdp->>Chromium: Write NUL-terminated command
  Chromium-->>Cdp: Return NUL-delimited reply
  Cdp-->>BrowserLaunch: Provide version reply
Loading
Merge Risk: Minimal · up to 6a852

On Windows, the LCD web page now talks to Edge or Chrome through private pipes instead of a local debugging port. The only edge case found is a browser that hangs without exiting: commands can then back up and stall that screen's renderer until the browser is closed. Linux pipes already behaved this way before this change. No merge-blocking issue was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: Windows LCD browser control moves from a debugging port to inherited pipes. The raw summary confirms src/web.rs switches Windows to pipe-based DevTools, and src/cdp.rs…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: Windows LCD browser control moves from a debugging port to inherited pipes. The raw summary confirms src/web.rs switches Windows to pipe-based DevTools, and src/cdp.rs drops the WebSocket path. The title is specific and matches the changeset. It is a single line, but at 80 characters it is long. The 'Security:' prefix is accurate because the objectives describe the move off a loopback port on 127.0.0.1.

Warning

Some tools did not complete. Review the errors below.

Clippy (1.99.1)

Clippy execution failed

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7ceb08ca-9d92-4525-a1ce-b3af11bc1fee
Commits

Reviewing files that changed from the base of the PR and between 44596ad and 6a852e3.

Files selected for processing: 4

  • Cargo.toml
  • docs/how-it-works.md
  • src/cdp.rs
  • src/web.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@kleju13

kleju13 commented Nov 14, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

AI agent on behalf of kleju13

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kleju13
kleju13 merged commit d08982a into main Nov 14, 2026
3 checks passed
@kleju13 kleju13 mentioned this pull request Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant