Skip to content

devcloud 0.12.0: a headless Chromium and poppler in the image, for the web fetch tool (board #133) - #374

Merged
SSFSKIM merged 3 commits into
mainfrom
devcloud-web-render
Oct 25, 2026
Merged

SSFSKIM merged 3 commits into
mainfrom
devcloud-web-render

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Board #133: devcloud hosts serve the web plugin's fetch tool (mcp__web__fetch) at the Macs' fidelity. Before this, a host could not render pages that need their scripts ("rendering unavailable on this machine: no Chromium found") and could not extract a PDF's text ("pdftotext is not on PATH").

What changes on hosts

  • pdftotext: poppler-utils in packages.sh's apt part.
  • A headless Chromium: a fourth packages.sh part, chromium, which the Dockerfile builds as its own layer. It installs Playwright's Chrome Headless Shell at /opt/ms-playwright, pinned by [email protected] (chromium_headless_shell-1248, Chrome for Testing 156.0.8078.4, the same build the Macs run), and only the shared libraries the binary links (checked against readelf's NEEDED list on both architectures). It also adds the link /usr/local/bin/chrome-headless-shell and an AppArmor profile, /etc/apparmor.d/devcloud-chrome-headless-shell, that grants that binary user namespaces. The profile is loaded at once wherever AppArmor runs (a VM's setup) and by apparmor.service at every boot.
  • WEB_CHROME: the boot writes it into /etc/devcloud/env as an image default (steps.IMAGE_ENV), below the profile's own values. Services read that file too, so a seat started by the sminos daemon finds the browser the same way a shell does. Setting WEB_CHROME=none in profile.env turns rendering off on every host.
  • devcloud 0.12.0.

The Chromium sandbox (the deciding question)

The clipper starts Chromium with its sandbox on. That sandbox needs unprivileged user namespaces, and Ubuntu 24.04 (kernel.apparmor_restrict_unprivileged_userns=1) allows them only for a program that an AppArmor profile names. Ubuntu ships such profiles for Google Chrome and others, but none for Playwright's paths.

VMs: the sandbox works with the image's profile. I tested both forms setup.sh builds, starting from this branch's recipe:

  • GCE e2 x86_64: Ubuntu 24.04.5, kernel 7.0.0-1014-gcp
  • Hetzner cax21 arm64: Ubuntu 24.04.4, kernel 6.8.0-138

On each, a running renderer had its own user and pid namespaces and seccomp mode 2. With the profile unloaded, the same fetch fails with No usable sandbox! and the tool keeps the plain fetch. After a reboot the profile was loaded again from /etc/apparmor.d (shown on GCE), so a baked image also gets it.

Containers: a default docker run cannot start the sandbox. Docker's default seccomp profile refuses to create a user namespace without CAP_SYS_ADMIN. The fetch then keeps the plain page with a "rendering failed … No usable sandbox!" note. It does not render unsandboxed. I measured four ways of running the container, as a non-root user, on colima (Docker 29.5.2) and on the Hetzner VM's Docker 29.9.2:

docker run with sandbox
no extra options (the README's sandbox command) fails
--security-opt seccomp=unconfined (Docker's AppArmor profile stays on) starts
--cap-add SYS_ADMIN starts
--privileged fails on colima, because the process is unconfined and falls under Ubuntu's restriction. It starts on a devcloud VM only because that host's own copy of the profile attaches by path.

For you to decide: I did not add --no-sandbox anywhere. If sandbox containers should render, these are the options, in my order of preference:

  1. Have whatever starts sandbox containers pass a seccomp profile that allows user namespaces. This could be Docker's default profile plus clone/unshare with CLONE_NEWUSER, or simply seccomp=unconfined. It loosens the container boundary somewhat, but keeps Chromium's sandbox and Docker's AppArmor profile.
  2. Leave sandboxes degraded, as they are now. They are short-lived and the note is honest.
  3. Use --no-sandbox in containers only, and treat the container as the boundary. That is what Playwright does by default, but the container holds the user's credentials as the same uid, so a compromised renderer reaches all of them.

Image size

  • Uncompressed, arm64 (colima, the layers from docker history): 2.48 → 3.04 GB, +562 MB.
    • The chromium layer is 537 MB: the browser is 280 MB, and libgbm1 pulls in mesa-libgallium and libllvm20 (with libicu74), about 220 MB.
    • The apt layer grew 25 MB for poppler.
  • What run.sh prints on the CI runners (x86_64): 0.7 → 0.9 GB. On colima the same docker image inspect figure (which looks like the compressed size) went from 0.776 to 0.987 GB.
  • On a cold CI build the new part took about 14 s.

Verification

  • CI: ci-gate is GREEN on x86_64 runners for the final HEAD (https://github.com/SSFSKIM/doperpowers/actions/runs/40230673533). This includes a new image case: as the user, in a container with seccomp unconfined standing in for a VM, the clipper renders a page built by script (106 words, rendered, no notes) and extracts a 3-page PDF (one outline entry per page; pdftotext version 24.02.0). It also includes a new host check: the user's zsh runs $WEB_CHROME.
  • Locally on colima (arm64): built the image and ran the same new image case: ok, 106 words.
  • The ticket's success criteria, live on both VMs as the user:
    • pdftotext -v reports 24.02.0.
    • clip.mjs fetch https://excalidraw.com/ renders 51 words with no notes.
    • clip.mjs fetch https://arxiv.org/pdf/1706.03762 saves page.txt (61,843 bytes) with 15 outline entries, one per page.
  • The service environment: WEB_CHROME is set for the sminos daemon and the other services on the GCE VM (read from /proc/<pid>/environ).
  • Unit tests: 739 devcloud unit tests pass locally.

Not verified

  • A microVM. None exists yet, and its rootfs might lack the apparmor package that loads the profile.
  • devcloud vm image build itself: the reboot shows the profile loads at boot, but I did not bake an image.
  • check_image on arm64. Locally it failed closed under colima's virtiofs (logged in the friction tracker). It passed in CI on x86_64.

Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)

…e web plugin's fetch tool (board #133)

packages.sh gains poppler-utils in part apt and a fourth part, chromium
(its own Dockerfile layer): Playwright's Chrome Headless Shell pinned by
playwright-core 1.64.1 (chromium_headless_shell-1248, the build the Macs
run) under /opt/ms-playwright, the shared libraries it links, a stable
/usr/local/bin/chrome-headless-shell, and an AppArmor profile granting the
binary user namespaces, which Ubuntu 24.04 grants no unconfined program and
Chromium's sandbox needs; loaded where AppArmor runs (a VM).

The boot writes WEB_CHROME into /etc/devcloud/env as an image default under
the profile's pairs (steps.IMAGE_ENV), so a session a service starts finds
the renderer as a shell's does. Tests: the image renders a script-built page
sandboxed and extracts a PDF's text as the user; the user's zsh runs
$WEB_CHROME on a booted host.

Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
The first gate run failed at the chromium part's --version check on the
runners: Chrome for Testing's linux64 build needs libatk-bridge-2.0, which
Playwright's arm64 build does not link (readelf NEEDED of both).

Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
…does and what a container needs

Sminos-Session: web-fetch-plugin#700c5e84 (doperpowers on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T20:31:53.720398Z c52b9a5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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