Report browser-control CDP commands in the control telemetry category - #323
Open
archandatta wants to merge 1 commit into
Conversation
archandatta
force-pushed
the
archand/kernel-1870/cdp-control-telemetry
branch
from
August 4, 2026 13:20
b630069 to
0296e93
Compare
archandatta
force-pushed
the
archand/kernel-1870/cdp-control-telemetry
branch
from
August 6, 2026 16:20
0296e93 to
0962339
Compare
archandatta
force-pushed
the
archand/kernel-1870/cdp-control-telemetry
branch
2 times, most recently
from
August 7, 2026 12:51
054ecbb to
59554b4
Compare
archandatta
marked this pull request as ready for review
August 7, 2026 13:43
api_call covers browser control issued through the kernel-images API, but a client driving the browser over the CDP proxy — Playwright, Puppeteer, an SDK — produced nothing at all, so a session whose agent works over CDP showed connect, disconnect and nothing in between. The proxy now emits cdp_command under control for the methods that drive the browser: input gestures, navigation, dialog handling, file selection and screenshots. Configuration and the DOM/Runtime traffic a client library issues on the caller's behalf stay out, and the phases that duplicate a gesture (mouseMoved, keyUp, char) are dropped so one action reads as one event. Payloads are shape only: method, session, event type, coordinates, button and the length of submitted text. Never the text, the key or the URL — control is captured by default, and on a login page those are the credentials. Frames are rejected by a single scan for the method name before anything is unmarshalled, so a large Runtime.callFunctionOn costs a scan rather than a parse. The parsed top-level method decides classification, so a nested "method" key cannot spoof one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
archandatta
force-pushed
the
archand/kernel-1870/cdp-control-telemetry
branch
from
August 7, 2026 13:43
59554b4 to
02ad34d
Compare
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.
Stacked on #322 — the base is that branch, so this diff is only the new event.
Summary
cdp_commandundercontrolfor the methods that drive the browser: input gestures, navigation, dialog handling, file selection and screenshotsRuntime.evaluateandRuntime.callFunctionOnare excluded deliberately, since every locator resolution is one and including them would bury the gesturesmouseMoved,keyUpandcharare dropped, so a click reads as a press and a release rather than three framesmethod,session_id,event_type,x,y,button,text_length, andkeyfor keys that command the page (Enter,Tab, arrows, modifiers, F-keys, by allowlist). Never typed characters, never the URL —controlis captured by defaultWhy
api_callcovers browser control that arrives through the kernel-images API, but a client driving the browser over the CDP proxy — Playwright, Puppeteer, an SDK — produced nothing at all. A session whose agent works over CDP showedcdp_connect,cdp_disconnect, and nothing in between.Hot path
Every client frame hits the transform, so classification scans for the frame's method name and does a map lookup; only an allowlisted method is unmarshalled, and a large
Runtime.callFunctionOncosts the scan rather than a parse. The scan checks every"method"the frame contains and the parsed top-levelmethodis what decides, so a nested"method"insideparamscan neither spoof a control command nor hide one.Existing behavior is unchanged: message relaying,
cdp_connect/cdp_disconnectand themessage_countthey report are untouched, and nothing is emitted for the upstream direction.Testing
go vet ./...clean;go test -racegreen across the non-e2e packagesTestUpstreamManagerDetectsChromiumAndRestartflakes about 1 in 4 runs on this package — reproduced on the unmodified base, it launches real Chromium. The new tests passed 10/10.Note
Medium Risk
Runs on every client CDP frame in the proxy hot path and emits control telemetry that is on by default; redaction mistakes could leak credentials, though tests explicitly guard typed text and URLs.
Overview
Adds
cdp_commandtelemetry (control) for client→browser CDP traffic through the DevTools WebSocket proxy, so Playwright/Puppeteer sessions are visible between connect and disconnect.The proxy’s message transform calls
publishCdpCommandonly on client-to-upstream text frames. Newcdpcommandlogic allowlists browser-control methods (input, navigation, screenshots, etc.), skips noisy phases (mouseMoved,keyUp,char) and library/runtime bookkeeping, and uses a byte scan before JSON parse on the hot path. Event payloads are shape-only (method, coordinates,text_length, allowlistednamed_key)—never typed text, URLs, or file paths.OpenAPI and generated
oapi/category_genregisterBrowserCdpCommandEventand mapcdp_commandtocontrol. Tests cover classification edge cases, secret leakage, and proxy-level emission counts.Reviewed by Cursor Bugbot for commit 02ad34d. Bugbot is set up for automated code reviews on this repo. Configure here.