Skip to content

feat: run in Linux containers - #4

Merged
samgozman merged 5 commits into
mainfrom
feat/linux-containers
Oct 24, 2026
Merged

samgozman merged 5 commits into
mainfrom
feat/linux-containers

Conversation

@samgozman

Copy link
Copy Markdown
Owner

What

  • Chrome as root: on Linux, when refetch runs as root (containers, devcontainers), the headless Chrome step runs Chrome as nobody with its sandbox on. Before, it was skipped. Other systems still skip it as root.
  • Playwright's Chromium: Chrome discovery also looks in PLAYWRIGHT_BROWSERS_PATH, /ms-playwright, /opt/pw-browsers and ~/.cache/ms-playwright, newest build first.
  • use_proxy (REFETCH_USE_PROXY, off by default): connections go through HTTPS_PROXY as CONNECT tunnels inside the public-only dialer, except to hosts NO_PROXY lists. Literal IPs and names that resolve locally still get the public-only check; a name only the proxy can resolve is left to it (SECURITY.md says so).
  • doctor: a network line, and a development checkout (plugin 0.0.0 through REFETCH_BIN) no longer gets /reload-plugins advice.

How it was checked

  • make lint cover-check (88.7%) and claude plugin validate . --strict.
  • Unit tests: both clients through a loopback CONNECT proxy (with auth), non-public targets refused before the proxy is asked, refusals reported, NO_PROXY, Playwright discovery, doctor's network and version lines.
  • Earlier, on a root Ubuntu 24.04 VM: Playwright's Chromium 141 was found and a JavaScript-only page rendered with Chrome running as nobody (3 s). Locally: fetches direct and through a CONNECT proxy with use_proxy, both clients and headless Chrome.

🤖 Generated with Claude Code

As root on Linux, the headless Chrome step now runs Chrome as the nobody
user with its sandbox on, instead of skipping. Chrome discovery also finds
Playwright's Chromium, which many Linux images ship instead of Chrome.

use_proxy (REFETCH_USE_PROXY) sends connections through HTTPS_PROXY as
CONNECT tunnels inside the public-only dialer, so TLS still runs end to
end. A name the proxy resolves is checked when it resolves locally. doctor
reports the proxy on a new network line, and no longer suggests
/reload-plugins for a development checkout run through REFETCH_BIN.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.10811% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.70%. Comparing base (9491015) to head (d199d73).

Files with missing lines Patch % Lines
render/render.go 50.00% 10 Missing ⚠️
fetch/proxy.go 93.24% 5 Missing ⚠️
render/sysproc_linux.go 81.81% 4 Missing ⚠️
render/chrome.go 95.74% 1 Missing and 1 partial ⚠️
fetch/fetch.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #4      +/-   ##
==========================================
+ Coverage   89.51%   89.70%   +0.19%     
==========================================
  Files          17       18       +1     
  Lines        1478     1652     +174     
==========================================
+ Hits         1323     1482     +159     
- Misses        155      169      +14     
- Partials        0        1       +1     
Files with missing lines Coverage Δ
cmd/refetch/doctor.go 91.11% <100.00%> (+0.41%) ⬆️
cmd/refetch/hook.go 89.63% <100.00%> (+0.06%) ⬆️
cmd/refetch/main.go 78.57% <100.00%> (+0.91%) ⬆️
config/config.go 91.30% <100.00%> (ø)
fetch/clients.go 86.27% <100.00%> (+11.76%) ⬆️
fetch/fetch.go 93.49% <83.33%> (-0.56%) ⬇️
render/chrome.go 95.08% <95.74%> (+8.41%) ⬆️
render/sysproc_linux.go 82.60% <81.81%> (-17.40%) ⬇️
fetch/proxy.go 93.24% <93.24%> (ø)
render/render.go 84.87% <50.00%> (-7.21%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

samgozman and others added 4 commits October 24, 2026 08:45
…Chromium's owner

Behind use_proxy, a name whose last label starts with a digit (0x7f.1,
2130706433) is refused instead of being left to the proxy, which may read
it as an address. A Playwright Chromium found by searching runs only if it
and the folders above it belong to root or this user and nobody else can
write to them; as root, the --version check also runs as nobody.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ainer blocks Chrome's sandbox

The profile walk goes through os.Root (gosec G122 fails CI's Linux lint).
Chrome as nobody no longer keeps root's supplementary groups. As root, a
Chrome that nobody cannot reach (in /root/.cache, say) is not picked. When
the container blocks the user namespaces Chrome's sandbox needs, the step
says so instead of "signal: aborted".

codecov.yml holds the project to 85%, the cover-check line, and a change
to 70% of its own lines.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
runAsNobody is split into nobody() and runAs(), so a test can hand a
profile to its own user without root. New tests cover nobodyCanRun, a
proxy that hangs up, is unreachable, has no port or sends bytes with its
reply, and an unparsable HTTPS_PROXY.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ers can write to it

Playwright's Docker images make /ms-playwright writable by everyone, so
refetch does not run that Chromium on its own. doctor now names it and the
REFETCH_CHROME setting that uses it anyway.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@samgozman samgozman added the ci:macos Run the macOS tests once label Oct 24, 2026
@github-actions github-actions Bot removed the ci:macos Run the macOS tests once label Oct 24, 2026
@samgozman
samgozman merged commit 0cf778e into main Oct 24, 2026
10 of 11 checks passed
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