NemoClaw icon indicating copy to clipboard operation
NemoClaw copied to clipboard

[Ubuntu/WSL2] Corporate proxy CA (#6210) is not applied to sandbox image build steps — `npm audit signatures` fails with SELF_SIGNED_CERT_IN_CHAIN on the reinstall path

Open Hokonoken opened this issue 4 months ago • 0 comments

Summary

#6210 makes a corporate proxy CA trusted at sandbox runtime — scripts/nemoclaw-start.sh merges the baked CA into the OpenShell trust bundle when the container starts. But the same CA is not available to the image build steps. When a sandbox image build takes the OpenClaw/mcporter reinstall path, the build runs npm audit signatures, which fetches the sigstore TUF root over TLS. Behind a TLS-intercepting corporate proxy that step fails with SELF_SIGNED_CERT_IN_CHAIN, so the whole build (onboard or rebuild) fails — even though the operator provided a corporate CA precisely so their proxy would work.

Where it triggers (precise scope)

The failing step only runs on the reinstall path (USE_REVIEWED_BASE_RUNTIME=0 in Dockerfile, the final FROM ${BASE_IMAGE} stage). Reading the gate (Dockerfile:293-357), the reviewed-base fast path is taken only when all of these hold: a trusted ghcr.io/nvidia/nemoclaw/sandbox-base (or -local) base, the baked provenance file present with exact owner/mode/content, and CUR_VER/CUR_MCPORTER_VER matching the target. When any of those does not hold, the build reinstalls OpenClaw + mcporter and runs npm audit signatures (Dockerfile:356). So this hits:

  • Custom-image sandboxes (--from <Dockerfile> with a non-ghcr base) — always TRUSTED_BASE_IMAGE=0.
  • Provenance/version-skew rebuilds where the base image's baked provenance does not exactly match the target.

A plain onboard on the official base image with matching provenance takes the fast path and skips the step, so it is unaffected — this is specifically the reinstall path.

Why the CA does not cover it

  • The corporate CA arrives as build ARG NEMOCLAW_CORPORATE_CA_B64 (Dockerfile:921) and is only decoded to /usr/local/share/nemoclaw/corporate-ca.pem at Dockerfile:962-973 — after the npm audit signatures step at line 356, in the same stage.
  • NODE_EXTRA_CA_CERTS is never exported at build time (no occurrence anywhere in Dockerfile), and update-ca-certificates is not run during build.
  • In this environment, ordinary npm registry operations (view, install, ci, audit --audit-level=low) succeed through the proxy, while the sigstore/TUF fetch in npm audit signatures fails without a trusted anchor; setting NODE_EXTRA_CA_CERTS to the corporate CA fixes exactly that step (proof below). The TUF client validates over Node's TLS stack, which honors NODE_EXTRA_CA_CERTS; I have not characterized why the plain registry calls succeed without it (the proxy may tunnel registry.npmjs.org rather than intercept it), so I state the asymmetry as observed rather than explain it.

So #6210's bake is runtime-only by construction; the build-time TLS path has no corporate anchor.

Reproduction (evidence)

Environment: Ubuntu/WSL2 x86_64 behind a TLS-intercepting corporate proxy; NemoClaw main (3de1de6b1), OpenShell 0.0.72, docker driver. Observed during a rebuild whose base provenance did not exact-match, so the reinstall path ran (build-log excerpt, buildkit timestamps elided):

#36 ... [stage-2 20/65] RUN ... (openclaw/mcporter provenance step)
#36 INFO: Base image OpenClaw 2026.6.10 lacks exact reviewed provenance; installing 2026.6.10
#36 added 298 packages in 23s
#36 INFO: Installing locked mcporter 0.7.3 dependency graph
#36 added 121 packages in 3s
#36 found 0 vulnerabilities
#36 npm error code SELF_SIGNED_CERT_IN_CHAIN
#36 npm error request to https://tuf-repo-cdn.sigstore.dev/16.root.json failed, reason: self-signed certificate in certificate chain
#36 ERROR: process "/bin/bash -o pipefail -c set -eu; ..." did not complete successfully: exit code: 1

Minimal A/B in the official base image, same container and network, isolating the step and the fix:

$ docker run --rm -v <corp-ca>.crt:/corp.crt:ro ghcr.io/nvidia/nemoclaw/sandbox-base:v0.0.81 bash -lc '
    mkdir /t && cd /t && npm init -y -s && npm install [email protected] --no-audit --no-fund
    echo "--- audit signatures WITHOUT corp CA:"; npm audit signatures
    echo "--- audit signatures WITH NODE_EXTRA_CA_CERTS=/corp.crt:"; NODE_EXTRA_CA_CERTS=/corp.crt npm audit signatures'

added 1 package in 983ms                              # registry install works through the proxy, no CA needed
--- audit signatures WITHOUT corp CA:
npm error code SELF_SIGNED_CERT_IN_CHAIN
npm error request to https://tuf-repo-cdn.sigstore.dev/16.root.json failed, reason: self-signed certificate in certificate chain
--- audit signatures WITH NODE_EXTRA_CA_CERTS=/corp.crt:
1 package has a verified registry signature

The asymmetry is controlled: same image, same proxy — registry install succeeds without the CA, npm audit signatures fails without it and passes once NODE_EXTRA_CA_CERTS points at the corporate CA. I also confirmed end-to-end that a full rebuild build completes when the corporate CA is decoded early and NODE_EXTRA_CA_CERTS is exported before the npm steps (patched the staged Dockerfile in a wrapper to prove it); with stock main the same build fails at the step above.

Suggested direction

When onboard resolves a corporate CA (the existing #6210 opt-in / conventional-CA fallback), make it available to the build TLS path as well, not just runtime: decode the CA early in the final build stage and export NODE_EXTRA_CA_CERTS=/usr/local/share/nemoclaw/corporate-ca.pem before the OpenClaw/mcporter reinstall steps. This does not weaken package trust — integrity pins and signature verification still run end-to-end; it only lets the TUF fetch traverse the operator's own proxy.

There is a scope decision for maintainers: export the anchor for the whole build stage vs. only the sigstore/TUF fetch in npm audit signatures. I lean toward the whole final stage (any build-time npm/TLS call behind the proxy benefits and it mirrors the runtime merge), but I'll follow your preference.

Offer

Happy to send a PR: decode the #6210 CA early in the final stage and export NODE_EXTRA_CA_CERTS for the build, with a test asserting the build stage carries the anchor when a corporate CA ARG is present. Confirm the scope (whole stage vs. audit-signatures only) and I'll implement it.

Hokonoken avatar Jul 14 '26 08:07 Hokonoken