Add optional Chrome DevTools Protocol (CDP) support per display - #11
Merged
Conversation
Setting cdp_port on a display now exposes Chromium's DevTools Protocol so external tools (Playwright, Puppeteer, browser automation agents) can drive the same browser session a human is observing over VNC. Chromium M113+ silently ignores --remote-debugging-address=0.0.0.0 and binds 127.0.0.1 regardless (upstream WontFix: crbug.com/40261787), so the addon now binds Chromium to a loopback-only internal port and forwards via socat. --remote-allow-origins=* is also injected automatically; without it modern Chromium rejects WebSocket upgrades from non-localhost callers. Off by default — only takes effect when cdp_port is set on a display. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Darktex
pushed a commit
to Darktex/ha-cups-epson
that referenced
this pull request
May 25, 2026
Patched fork of MindFreeze/ha-vnc-web-browser that adds an optional cdp_port field per display, exposing Chromium's DevTools Protocol via a socat forwarder. Needed because Chromium M113+ silently downgrades --remote-debugging-address=0.0.0.0 to 127.0.0.1 (upstream WontFix: crbug.com/40261787). Upstream PR: MindFreeze/ha-vnc-web-browser#11 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
MindFreeze
reviewed
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional
cdp_portfield per display that exposes Chromium's Chrome DevTools Protocol so external tools (Playwright, Puppeteer, browser automation agents, AI agents) can drive the same browser session that a human is observing over VNC. Off by default.The motivating use case: agentic browser automation on Home Assistant OS. The agent needs CDP; the human needs VNC to watch and occasionally take over (captchas, teaching). This addon already nails the VNC + persistent-profile side beautifully — CDP is the natural complement.
Why this isn't just
--remote-debugging-port=9222inbrowser_argsSince Chromium M113,
--remote-debugging-address=0.0.0.0is silently downgraded to127.0.0.1as a security hardening measure (upstream WontFix: crbug.com/40261787). The flag passes through but the binding is loopback-only, so nothing outside the container can reach CDP — even when you publish 9222 inconfig.yaml, the host-side port forward points at a closed socket.This PR works around it the same way every Chromium-in-container project does (Browserless, Playwright Docker, etc.): bind Chromium to a loopback-only internal port, then forward
0.0.0.0:cdp_port → 127.0.0.1:internalviasocat.--remote-allow-origins=*is also injected — without it, modern Chromium rejects WebSocket upgrades from non-localhost callers with a 403, which silently breaks Playwright/Puppeteer (HTTP/json/versionworks, WS doesn't).Changes
socat; expose 9221-9224.ports:(defaulted tonullso they're reachable from sibling addons but not published to the host unless explicitly configured); addcdp_port: int(9221,9224)?to the per-display schema; bump version to 0.13.0.cdp_portis set on a display, strip any conflicting--remote-debugging-*flags from user-suppliedbrowser_args, inject--remote-debugging-port=<internal>(=cdp_port + 100) and--remote-allow-origins=*, and launch asocatforwarder.cdp_portand explain the M113+ workaround.Backwards compatibility
Fully backwards compatible. Existing configs without
cdp_portbehave identically — no socat is launched, no flags injected. Users who previously put--remote-debugging-port=9222intobrowser_args(which didn't actually work because of M113+) will see those flags silently stripped if they also setcdp_port, which is the safer behavior.Test plan
cdp_portstill work (no socat, no extra flags)cdp_port: 9222,curl http://<addon-host>:9222/json/versionreturns Chromium build infoconnect_over_cdp("ws://<addon-host>:9222")connects successfully (verifies--remote-allow-origins)🤖 Generated with Claude Code