Skip to content

fix(docker): harden runtime images against CVE surface - #123282

Merged
steipete merged 9 commits into
mainfrom
steipete/docker-image-cve-hardening
Aug 13, 2026
Merged

steipete merged 9 commits into
mainfrom
steipete/docker-image-cve-hardening

Conversation

@steipete

@steipete steipete commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Published Docker images carry far more vulnerability-scanner findings than they need to, and third parties have started benchmarking against them (Echo's 2026-08-04 "eliminated 1,400 CVEs" post scans openclaw:latest and latest-browser as the unflattering comparison). Reproducing those scans and decomposing every finding shows four self-inflicted contributors on top of the irreducible Debian wont-fix tail:

  • Workspace devDependencies leak into the runtime image: pnpm prune --prod runs at build, but omitted plugins' optional peer dependencies (qa-lab → vitest → vite → postcss) survive the omitted-closure walk in the hoisted layout and ship in /app/node_modules.
  • No apt-get dist-upgrade runs, so Debian point-release security fixes newer than the pinned base digest never land (e.g. libgnutls30 deb12u7, which fixes 2 Critical CVEs, existed but wasn't in the image).
  • The node base image's bundled npm CLI ships a stale dependency tree (19 Grype findings: undici, tar, ip-address…) that nothing refreshed.
  • Lockfile lagged on hono (< 4.12.34, 4 findings, held back by a stale workspace override) and dompurify 3.4.12 (1 finding).

Why This Change Was Made

  • scripts/prune-docker-plugin-dist.mjs: omitted-plugin removal closure now traverses peerDependencies (including installed optional peers); the kept runtime closure remains authoritative, so nothing needed at runtime can be removed. Regression test added.
  • Dockerfile: apt-get dist-upgrade -y in the runtime stage with a comment naming the contract (point-release fixes must land without waiting for a base-digest refresh); npm CLI upgraded to current with its bundled dependency tree refreshed (dev-tool metadata hidden during the script-free refresh, original manifest restored).
  • Deps: removed the stale hono workspace override (introduced by routine deps sweep chore: update dependencies across workspace #115677, not a deliberate pin) so it floats to 4.13.2; dompurify 3.4.13; playwright/playwright-core 1.62.0 → 1.62.1 (same Chromium 151.0.7922.34 pin).
  • docs/install/docker.md: documents image contents and scanning posture; fixes a stale sentence that still claimed release builds run no distro upgrade layer.

Rebuild cadence for published tags (the remaining staleness class: latest-browser ships Chromium 149 while current Playwright pins 151) is deliberately out of scope — tracked in a follow-up issue.

User Impact

  • Default image: 474 → 450 Grype findings on identical scanner DB; zero remaining findings with an available fix in the app tree, npm CLI, or fixable Debian set; both fixable Critical CVEs (libgnutls30) resolved. Image 1.68 GB → 1.51 GB (compressed 354 MB → 281 MB); /app/node_modules 610 MB → 533 MB with vitest, @vitest/*, and postcss gone. TypeScript intentionally stays (production dependency; Code Mode imports it).
  • Browser image: 3.44 GB → 3.30 GB; scan drops to 978 (from 1,966 on the published image, mostly via the current Chromium pin at build time).
  • Operators who docker build --pull get current Debian security state on every rebuild.

Evidence

  • Builds: default + OPENCLAW_INSTALL_BROWSER=1 variants both green.
  • Smoke in hardened image: openclaw --version (2026.8.1), openclaw plugins list (38/58 enabled), release-workflow workspace-template smoke exit 0, and a live gateway boot serving the Control UI (/ and /health HTTP 200) — exercises the hono 4.13 HTTP seam end to end.
  • Contents verified in-container: no vitest/@vitest/postcss; libgnutls30 3.7.9-2+deb12u7; npm 12.0.2; hono 4.13.2; dompurify 3.4.13; Chromium 151.0.7922.34 in the browser variant.
  • Grype (same DB, before → after): default 474 → 450 (Critical 37 → 36); browser 1,966 (published) → 978. Zero findings under /usr/local/lib/node_modules/npm, zero for vitest/postcss/nanoid/@vitest/browser.
  • Focused tests: src/plugins/prune-docker-plugin-dist.test.ts 41 tests green; docs MDX check 773 files green; git diff --check clean.
  • Codex autoreview: clean, no accepted/actionable findings.

Main-breakage repair: PR #114506 (merged 2026-08-12) added native-host interpreter ownership validation but left extensions/browser/src/browser/pw-tools-core.last-file-chooser-arm-wins.test.ts, extensions/browser/src/browser/pw-tools-core.screenshots-element-selector.test.ts, and extensions/browser/src/browser/extension-install.test.ts stale and unhermetic in a shard PRs rarely select. The failures reproduce on pristine main; this PR repairs them per red-main landing policy in commits e232f73, 83ac118, and 253ae3d. The intermediate diagnostic commit 7b670ef is reverted by 253ae3d and disappears in the squash. The pre-existing qa-lab Matrix health-probe deadline race in the extensions-config-3 shard is also fixed here in commit a8371cf.

The device-scope UI E2E callout-inset flake is fixed by polling the geometry invariant (commit 51ef132).

@clawsweeper

clawsweeper Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete steipete self-assigned this Aug 13, 2026
@steipete
steipete marked this pull request as ready for review August 13, 2026 18:13
@steipete
steipete requested a review from a team as a code owner August 13, 2026 18:13
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui scripts Repository scripts docker Docker and sandbox tooling extensions: qa-lab extensions: diffs extensions: browser size: S maintainer Maintainer-authored PR labels Aug 13, 2026
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • extensions/browser/package.json
  • extensions/diffs/package.json
  • extensions/qa-lab/package.json
  • package.json
  • pnpm-lock.yaml
  • pnpm-workspace.yaml
  • ui/package.json

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfiles or workspace dependency policy changes are present.
  • Treat pnpm-lock.yaml and package-lock.json diffs as dependency security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions

github-actions Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph changes noted

This PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of @openclaw/openclaw-secops.

  • Current SHA: 51ef132810632df984b55dc9f9fa7d4d8a24265b
  • Trusted actor: @steipete
  • Trusted role: pull request author; openclaw-secops

Security review is still recommended before merge when the dependency graph change is intentional.

@socket-security

socket-security Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​dompurify@​3.4.12 ⏵ 3.4.13100 +1100 +21009270
Updatednpm/​playwright-core@​1.62.0 ⏵ 1.62.110010079 +19980
Updatednpm/​playwright@​1.62.0 ⏵ 1.62.11001001009980

View full report

The suite passed process.execPath as the native-host interpreter; on
GitHub-hosted runners the hostedtoolcache node binary is group/world-
writable, which installChromeExtensionBootstrap correctly refuses, so
every registration test failed CI-only. The fixture now provides an
owned 0700 interpreter; only the launcher-exec test keeps the real
node it must spawn.
…dline

The Matrix health-probe loop re-entered when the probe timeout fired
marginally before Date.now() crossed the deadline, starting a doomed
extra probe. Flaked on contended CI runners as 'expected 1 fetch, got
2'. A timed-out probe now ends discovery.
One-shot boundingBox reads raced the nav-collapse transition and
intermittently measured a 20px stale offset on CI.
@steipete
steipete merged commit b3d5265 into main Aug 13, 2026
145 of 146 checks passed
@steipete
steipete deleted the steipete/docker-image-cve-hardening branch August 13, 2026 21:02
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 14, 2026
* fix(docker): harden runtime image dependencies

* chore(deps): update container security dependencies

* docs(docker): explain image security contents

* test(browser): align file-chooser and install tests with openclaw#114506 contract

* test(browser): restore extension install test isolation

* test(browser): add temporary CI diagnostics for pre-registration refusal

* test(browser): make install fixture interpreter hermetic

The suite passed process.execPath as the native-host interpreter; on
GitHub-hosted runners the hostedtoolcache node binary is group/world-
writable, which installChromeExtensionBootstrap correctly refuses, so
every registration test failed CI-only. The fixture now provides an
owned 0700 interpreter; only the launcher-exec test keeps the real
node it must spawn.

* fix(qa-lab): stop re-polling after a probe consumes the discovery deadline

The Matrix health-probe loop re-entered when the probe timeout fired
marginally before Date.now() crossed the deadline, starting a doomed
extra probe. Flaked on contended CI runners as 'expected 1 fetch, got
2'. A timed-out probe now ends discovery.

* test(ui): poll the callout inset invariant in device-scope E2E

One-shot boundingBox reads raced the nav-collapse transition and
intermittently measured a 20px stale offset on CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui dependencies-changed PR changes dependency-related files docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: browser extensions: diffs extensions: qa-lab maintainer Maintainer-authored PR scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant