Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions docs/security/openclaw-2026.6.10-dependency-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,13 @@ The legacy `2026.3.11` and `2026.4.24` OpenClaw pins are retained only for stale

Frozen OpenShell gateway-upgrade fixtures select only the SRI-pinned OpenClaw `2026.4.24`, `2026.5.22`, or `2026.5.27` archive.
The live test uses `packReviewedNpmArchive` to verify exact registry metadata, the reviewed tarball URL, and the downloaded SRI.
The adapter copies only that verified local archive into the historical build context.
The adapter stores only that verified local archive at `nemoclaw/src/.nemoclaw-e2e-old-openclaw.tgz`, which the frozen optimized build-context staging preserves.
It installs the archive with lifecycle scripts disabled and invokes `postinstall-bundled-plugins.mjs` directly.
The fixtures retain npm registry signature verification for the historical mcporter lock.
The adapter requires exactly one advisory audit statement before it replaces that statement with a test-only skip.
The `v0.0.74` fixture retains npm registry signature verification for its historical mcporter lock.
The reviewed `v0.0.36` and `v0.0.55` profiles require no advisory audit statement.
The reviewed `v0.0.74` profile requires exactly one advisory audit statement, which the adapter replaces with a test-only skip.
Each audit policy is bound to one exact reviewed NemoClaw tag, full commit SHA, and OpenClaw version tuple before the installer is patched.
The adapter rejects an unknown or mixed tuple and any advisory audit count that does not match its reviewed profile.
`test/e2e/support/openshell-gateway-upgrade-old-installer.test.ts` verifies these constraints.

Invalid state: a production image build overriding `OPENCLAW_VERSION` to an old fixture pin or replacing any repository-reviewed integrity/tarball value while still passing the workflow boundary. Source boundary: Dockerfile and Dockerfile.base install blocks plus the guard that precedes every production image build. Source-fix constraint: keep stale-upgrade E2Es able to build old images without normalizing those pins or accepting caller-controlled production package identity. Regression tests: the integrity-pin contract suite rejects the flag, both legacy versions, all declared integrity/tarball ARG overrides through direct, `--build-arg`, and environment paths, and a future-shaped positional pin name; `test/openclaw-dependency-review.test.ts` proves all seven production image builds are guard-protected and carry no literal fixture selectors. Removal condition: issue #5896 section 9 retires the old-base fixture strategy and fixture flag; the general repository-owned production pin guard remains until production builds no longer expose package identity as Docker ARGs.
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/live/openshell-gateway-upgrade-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { shellQuote } from "../fixtures/clients/command.ts";
import { reviewedOldInstallerProfile } from "./openshell-gateway-upgrade-old-installer.ts";

const NON_INTERACTIVE_INSTALLER_ARGS = ["--non-interactive", "--yes-i-accept-third-party-software"];
const GATEWAY_VOLUME_PREFIX = "openshell-cluster-nemoclaw";
Expand Down Expand Up @@ -35,6 +36,7 @@ export function validateLegacyGatewayUpgradeFixture(fixture: LegacyGatewayUpgrad
`NEMOCLAW_OLD_OPENCLAW_VERSION must use the YYYY.M.D release format; got ${fixture.openclawVersion}`,
);
}
reviewedOldInstallerProfile(fixture);
const sandboxBaseDigest = fixture.sandboxBaseImageRef.match(
/^[^@\s]+@sha256:([0-9a-f]{64})$/,
)?.[1];
Expand Down
82 changes: 73 additions & 9 deletions test/e2e/live/openshell-gateway-upgrade-old-installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ export type ReviewedOldOpenClawArchive = Readonly<{
tarballUrl: string;
}>;

export type OldInstallerFixtureIdentity = Readonly<{
nemoclawCommit: string;
nemoclawRef: string;
openclawVersion: string;
}>;

type ReviewedOldInstallerProfile = OldInstallerFixtureIdentity &
Readonly<{
expectedAdvisoryAuditCount: 0 | 1;
}>;

const REVIEWED_OLD_OPENCLAW_ARCHIVES: Readonly<Record<string, ReviewedOldOpenClawArchive>> =
Object.freeze({
"2026.4.24": {
Expand Down Expand Up @@ -40,6 +51,29 @@ export const OLD_INSTALLER_CLONE_NEEDLE =
' spin "Cloning ${_CLI_DISPLAY} source" clone_nemoclaw_ref "$release_ref" "$nemoclaw_src"\n';
export const OLD_INSTALLER_ADVISORY_AUDIT =
" npm --prefix /usr/local/lib/nemoclaw/mcporter-runtime audit --omit=dev --audit-level=low; \\\n";
export const OLD_INSTALLER_ARCHIVE_CONTEXT_PATH = "nemoclaw/src/.nemoclaw-e2e-old-openclaw.tgz";

const REVIEWED_OLD_INSTALLER_PROFILES: Readonly<Record<string, ReviewedOldInstallerProfile>> =
Object.freeze({
"v0.0.36": Object.freeze({
expectedAdvisoryAuditCount: 0,
nemoclawCommit: "3351fbdd4eb7d9b80ec471545083956327da2b10",
nemoclawRef: "v0.0.36",
openclawVersion: "2026.4.24",
}),
"v0.0.55": Object.freeze({
expectedAdvisoryAuditCount: 0,
nemoclawCommit: "95d483fe2b6569d68e59493c60f19df09a068e8f",
nemoclawRef: "v0.0.55",
openclawVersion: "2026.5.22",
}),
"v0.0.74": Object.freeze({
expectedAdvisoryAuditCount: 1,
nemoclawCommit: "3a05b54e8ec3e1d5550ec5c728de54af872bffe3",
nemoclawRef: "v0.0.74",
openclawVersion: "2026.5.27",
}),
});

export function reviewedOldOpenClawArchive(version: string): ReviewedOldOpenClawArchive {
const reviewedArchive = REVIEWED_OLD_OPENCLAW_ARCHIVES[version];
Expand All @@ -49,11 +83,33 @@ export function reviewedOldOpenClawArchive(version: string): ReviewedOldOpenClaw
return reviewedArchive;
}

export function reviewedOldInstallerProfile(
identity: OldInstallerFixtureIdentity,
): ReviewedOldInstallerProfile {
const profile = REVIEWED_OLD_INSTALLER_PROFILES[identity.nemoclawRef];
if (
!profile ||
profile.nemoclawCommit !== identity.nemoclawCommit ||
profile.openclawVersion !== identity.openclawVersion
) {
throw new Error(
`Historical gateway upgrade fixture must match an exact reviewed ref/commit/OpenClaw profile; got ${identity.nemoclawRef}/${identity.nemoclawCommit}/${identity.openclawVersion}`,
);
}
return profile;
}

// The frozen release installers are the source of truth, but their embedded
// Dockerfiles predate the fixture pins needed for a deterministic upgrade test.
// Keep this adapter scoped to the frozen historical lanes and retire it with
// them; changing the tagged release payloads is not viable.
export function patchOldInstallerFixture(installer: string): void {
export function patchOldInstallerFixture(
installer: string,
identity: OldInstallerFixtureIdentity,
): void {
const profile = reviewedOldInstallerProfile(identity);
const expectedAdvisoryAuditCount = profile.expectedAdvisoryAuditCount;

const hook =
String.raw` if [[ -n "\${NEMOCLAW_OLD_OPENCLAW_VERSION:-}" && -f "$payload_script" ]]; then
python3 - "$payload_script" <<'NEMOCLAW_OLD_PAYLOAD_PIN_PY'
Expand All @@ -68,7 +124,12 @@ hook = r''' if [[ -n "\${NEMOCLAW_OLD_OPENCLAW_VERSION:-}" ]]; then
echo "ERROR: reviewed historical OpenClaw archive is missing" >&2
exit 1
fi
cp -- "$NEMOCLAW_OLD_OPENCLAW_ARCHIVE" "$nemoclaw_src/.nemoclaw-e2e-old-openclaw.tgz"
archive_context_path="$nemoclaw_src/${OLD_INSTALLER_ARCHIVE_CONTEXT_PATH}"
if [[ ! -d "$(dirname "$archive_context_path")" ]]; then
echo "ERROR: historical OpenClaw archive context directory is missing" >&2
exit 1
fi
cp -- "$NEMOCLAW_OLD_OPENCLAW_ARCHIVE" "$archive_context_path"
python3 - "$nemoclaw_src/Dockerfile" "$NEMOCLAW_OLD_OPENCLAW_VERSION" <<'NEMOCLAW_OLD_DOCKERFILE_PIN_PY'
from pathlib import Path
import sys
Expand All @@ -78,7 +139,7 @@ version = sys.argv[2]
text = path.read_text(encoding="utf-8")
injection = (
"# E2E old-upgrade fixture: force the historical OpenClaw before the old Dockerfile's version gate.\n"
"COPY .nemoclaw-e2e-old-openclaw.tgz /tmp/nemoclaw-e2e-old-openclaw.tgz\n"
"COPY ${OLD_INSTALLER_ARCHIVE_CONTEXT_PATH} /tmp/nemoclaw-e2e-old-openclaw.tgz\n"
"RUN rm -rf /usr/local/lib/node_modules/openclaw /usr/local/bin/openclaw \\\n"
" && npm install -g --ignore-scripts --no-audit --no-fund --no-progress /tmp/nemoclaw-e2e-old-openclaw.tgz \\\n"
" && node /usr/local/lib/node_modules/openclaw/scripts/postinstall-bundled-plugins.mjs \\\n"
Expand All @@ -105,14 +166,17 @@ if injection not in text:

advisory_audit = ${JSON.stringify(OLD_INSTALLER_ADVISORY_AUDIT)}
advisory_audit_count = text.count(advisory_audit)
if advisory_audit_count != 1:
expected_advisory_audit_count = ${expectedAdvisoryAuditCount}
if advisory_audit_count != expected_advisory_audit_count:
raise SystemExit(
f"{path}: found {advisory_audit_count} historical mcporter advisory audits; expected exactly one"
f"{path}: found {advisory_audit_count} historical mcporter advisory audits; "
f"expected {expected_advisory_audit_count}"
)
audit_fixture_note = (
' echo "INFO: Skipping current advisory audit for the immutable historical mcporter lock"; \\\n'
)
text = text.replace(advisory_audit, audit_fixture_note, 1)
if expected_advisory_audit_count == 1:
audit_fixture_note = (
' echo "INFO: Skipping current advisory audit for the immutable historical mcporter lock"; \\\n'
)
text = text.replace(advisory_audit, audit_fixture_note, 1)

path.write_text(text, encoding="utf-8")
print(f"INFO: Forced OpenClaw {version} in old upgrade fixture Dockerfile", flush=True)
Expand Down
11 changes: 7 additions & 4 deletions test/e2e/live/openshell-gateway-upgrade.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,14 @@ const OLD_SANDBOX_BASE_IMAGE_REF =
process.env.NEMOCLAW_OLD_SANDBOX_BASE_IMAGE_REF ??
"ghcr.io/nvidia/nemoclaw/sandbox-base@sha256:104151ffadc2ff0b6c815e3c95c2783ced61aee0d0f83fc327cc02be9b7e14e6";
const OLD_OPENCLAW_VERSION = process.env.NEMOCLAW_OLD_OPENCLAW_VERSION ?? "2026.4.24";
const { sandboxBaseDigest: OLD_SANDBOX_BASE_DIGEST } = validateLegacyGatewayUpgradeFixture({
nemoclawRef: OLD_NEMOCLAW_REF,
const OLD_INSTALLER_FIXTURE_IDENTITY = Object.freeze({
nemoclawCommit: OLD_NEMOCLAW_COMMIT,
installerSha256: OLD_INSTALLER_SHA256,
nemoclawRef: OLD_NEMOCLAW_REF,
openclawVersion: OLD_OPENCLAW_VERSION,
});
const { sandboxBaseDigest: OLD_SANDBOX_BASE_DIGEST } = validateLegacyGatewayUpgradeFixture({
...OLD_INSTALLER_FIXTURE_IDENTITY,
installerSha256: OLD_INSTALLER_SHA256,
sandboxBaseImageRef: OLD_SANDBOX_BASE_IMAGE_REF,
});
const SURVIVOR_SANDBOX =
Expand Down Expand Up @@ -403,7 +406,7 @@ async function installOldNemoclawAndClaw(
`downloaded ${OLD_NEMOCLAW_REF} installer must match its pinned SHA-256`,
).toBe(OLD_INSTALLER_SHA256);
fs.chmodSync(oldInstaller, 0o755);
patchOldInstallerFixture(oldInstaller);
patchOldInstallerFixture(oldInstaller, OLD_INSTALLER_FIXTURE_IDENTITY);

const reviewedOpenClaw = packReviewedNpmArchive(reviewedOldOpenClawArchive(OLD_OPENCLAW_VERSION));

Expand Down
Loading
Loading