Repository navigation
Security: drive the LCD's browser through pipes on Windows, not a debugging port - #85
Conversation
…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>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
@coderabbitai review AI agent on behalf of kleju13 |
Action performed
|
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.
--remote-debugging-pipeand 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.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.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.mdhas 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 --lockedon Linux: 178, 36 and 25 tests pass.cargo test --workspace --lockedforx86_64-pc-windows-gnuunder 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.camless lcd page URLwithout 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