Why the GHCR visibility flipper drives a real browser
A short, self-contained explainer of what the GHCR flip script (../flip_sec_ace.py) actually
does and the browser-automation ideas behind it. This folder is a standalone learning packet —
it can be lifted out of the repo without affecting the release tooling.
Not needed to run the release. It only explains the how/why of the flipper.
What the flip code does (the 60-second version)
GitHub has no API to make a container package public — the only way is clicking
Settings → Danger Zone → Change visibility → Public in a logged-in browser. Doing that 337
times by hand is miserable, so flip_sec_ace.py has a real browser do the clicking:
- Playwright launches your installed Google Chrome with a saved profile, so you log in
once (passkey / Touch ID works because it’s real Chrome, not the bundled Chromium). - For each of the 337 allowlisted packages it drives the actual web UI:
open the package’s settings page → click Change visibility → select Public →
type the package name to confirm → click confirm. - It talks to Chrome over CDP (the Chrome DevTools Protocol): a JSON-RPC control channel.
Each click becomes real, trusted input events dispatched into the browser — so GitHub sees
exactly what it would from a human, and cookies + CSRF + the passkey are handled natively
by the browser. The visibility POST is sent by Chrome itself. - It’s cautious: validates the first 3, retries each package, skips already-public ones, and
reports any failures.
So: no API, no token forging — just a scripted real browser clicking the real buttons.
flip_sec_ace.py (fixed script, no AI)
│ Playwright (get_by_role / fill / click — auto-waited)
▼
CDP / JSON-RPC (Page.navigate · DOM.getBoxModel · Input.dispatchMouseEvent · Runtime.evaluate)
▼
real logged-in Chrome → GitHub's UI → "Change visibility → Public" × 337
The three big ideas (so the above isn’t magic)
- A webpage is HTML (text) → a DOM tree → pixels. It is not JSON, and the browser is a
GUI app, not a CLI. (Fig 1, 2) - CDP is a separate JSON control channel bolted onto the browser — how an outside program
drives/inspects it. The page is on the data plane; CDP is the control plane. (Fig 3) - Playwright is just an ergonomic, race-proof layer over CDP (auto-waiting, locators,
retries). You could call CDP directly; Playwright saves you from the timing bugs. (Fig 4) - Put an AI model in the loop choosing the steps (from the accessibility tree, or from
screenshots) and the same plumbing becomes agent “computer use.” (Fig 5)
Files
| File | What |
|---|---|
| Browsers, Playwright, and Agent Computer Use | The full self-contained tutorial (HTML/CSS/JS → DOM → pixels; images/video/PDF; CDP; Playwright actions → CDP; agent computer-use; benchmarks & RL envs), figures as ASCII. |
| see Figures in Browsers, Playwright, and Agent Computer Use | HTML → DOM → pixels. |
| see Figures in Browsers, Playwright, and Agent Computer Use | A worked DOM example: HTML snippet → the exact node tree. |
| see Figures in Browsers, Playwright, and Agent Computer Use | How images/video/fonts load and decode into one frame. |
| see Figures in Browsers, Playwright, and Agent Computer Use | Chrome’s multi-process architecture. |
| see Figures in Browsers, Playwright, and Agent Computer Use | Data plane (page) vs control plane (CDP). |
| see Figures in Browsers, Playwright, and Agent Computer Use | Playwright layered over CDP over the browser. |
| see Figures in Browsers, Playwright, and Agent Computer Use | DOM-agent vs vision-agent “computer use” loops. |
See the CDP traffic yourself
Run any Playwright script with these env vars (the sibling ../flip_sec_ace.py is a ready example):
DEBUG=pw:protocol python3 your_script.py # dump every CDP message to stderr
PWDEBUG=1 python3 your_script.py # open the visual step-through inspector§4.2 of the tutorial shows an annotated trace of one .click().