diff --git a/ci/pi-agent-qualification-v1-linux-amd64.json b/ci/pi-agent-qualification-v1-linux-amd64.json index f463a0fe1cd..24cda4c8d69 100644 --- a/ci/pi-agent-qualification-v1-linux-amd64.json +++ b/ci/pi-agent-qualification-v1-linux-amd64.json @@ -3,13 +3,13 @@ "agent": "pi", "platform": "linux/amd64", "image": "ghcr.io/nvidia/nemoclaw/pi-sandbox", - "digest": "sha256:1b4cfca2be5b5c829f1e47b92b50eecf961f17fecf51ded839f20b35c2368d39", - "reference": "ghcr.io/nvidia/nemoclaw/pi-sandbox@sha256:1b4cfca2be5b5c829f1e47b92b50eecf961f17fecf51ded839f20b35c2368d39", + "digest": "sha256:ea5ffaa221c997ded8dc8d7411048d3ae8d52fe8aa95c15c49b014f0676ebb87", + "reference": "ghcr.io/nvidia/nemoclaw/pi-sandbox@sha256:ea5ffaa221c997ded8dc8d7411048d3ae8d52fe8aa95c15c49b014f0676ebb87", "source": { "repository": "NVIDIA/NemoClaw", - "revision": "3acbec263ff059c0d2e85caa82118c0d85cb0238", - "release": "v0.0.145-12-g3acbec263f", - "cohort": "ghrun-44923815295-1" + "revision": "8f35784f795552c3f44579448f667284610e6885", + "release": "v0.0.145-17-g8f35784f7", + "cohort": "ghrun-45954843884-1" }, "startupProfileContractVersion": 1, "capabilityContractVersion": 1 diff --git a/ci/pi-agent-qualification-v1-linux-arm64.json b/ci/pi-agent-qualification-v1-linux-arm64.json index 350d49678ef..14bd114bde3 100644 --- a/ci/pi-agent-qualification-v1-linux-arm64.json +++ b/ci/pi-agent-qualification-v1-linux-arm64.json @@ -3,13 +3,13 @@ "agent": "pi", "platform": "linux/arm64", "image": "ghcr.io/nvidia/nemoclaw/pi-sandbox", - "digest": "sha256:d3cdfa6b6a46e82fd81d689e91404360066059708230539736ae88c689d4df50", - "reference": "ghcr.io/nvidia/nemoclaw/pi-sandbox@sha256:d3cdfa6b6a46e82fd81d689e91404360066059708230539736ae88c689d4df50", + "digest": "sha256:5d81a11409580b8225cde6aead2d5dde1d63fca84ccbe1acb1773771721f298d", + "reference": "ghcr.io/nvidia/nemoclaw/pi-sandbox@sha256:5d81a11409580b8225cde6aead2d5dde1d63fca84ccbe1acb1773771721f298d", "source": { "repository": "NVIDIA/NemoClaw", - "revision": "3acbec263ff059c0d2e85caa82118c0d85cb0238", - "release": "v0.0.145-12-g3acbec263f", - "cohort": "ghrun-44923815295-1" + "revision": "8f35784f795552c3f44579448f667284610e6885", + "release": "v0.0.145-17-g8f35784f7", + "cohort": "ghrun-45954843884-1" }, "startupProfileContractVersion": 1, "capabilityContractVersion": 1 diff --git a/scripts/security/build-native-security-packages.sh b/scripts/security/build-native-security-packages.sh index 0cc0247383c..bd4259b0e00 100755 --- a/scripts/security/build-native-security-packages.sh +++ b/scripts/security/build-native-security-packages.sh @@ -281,7 +281,7 @@ build_zlib_package() { ./write-error-test ) download \ - "https://deb.debian.org/debian/pool/main/z/zlib/zlib1g_1.3.dfsg%2Breally1.3.1-1%2Bb1_${architecture}.deb" \ + "https://snapshot.debian.org/archive/debian/20250810T000000Z/pool/main/z/zlib/zlib1g_1.3.dfsg%2Breally1.3.1-1%2Bb1_${architecture}.deb" \ "${original_deb}" verify_sha256 "${original_sha256}" "${original_deb}" test "$(dpkg-deb -f "${original_deb}" Package)" = zlib1g diff --git a/src/lib/agent/candidate-authority.ts b/src/lib/agent/candidate-authority.ts index 0bc4ff6e1e7..0a1b5f0ea23 100644 --- a/src/lib/agent/candidate-authority.ts +++ b/src/lib/agent/candidate-authority.ts @@ -13,8 +13,8 @@ export const CANDIDATE_QUALIFICATION_RECEIPT_DIGESTS: Readonly< Record > = Object.freeze({ pi: Object.freeze([ - "99448184097d195f3705571d3b276c423931f3e99e7bd486b4996933933e4572", - "9413ec7f193098d4759a2d37368efda5514563dc03d1d3d5133afd4428e9dbc7", + "97b03dcafb2e66f372a43da02c2f10a5b97469211a461926b818246df10825fa", + "5f31a8fa415c429d00371f4eb0cc3f286af66746e4be3f9158109624b6b8ba3c", ]), }); diff --git a/test/install/native-security-packages.test.ts b/test/install/native-security-packages.test.ts index b663b817d90..12f514327dd 100644 --- a/test/install/native-security-packages.test.ts +++ b/test/install/native-security-packages.test.ts @@ -150,7 +150,116 @@ function runPythonFixPackageHarness(architecture: "amd64" | "arm64", sourceHashF return { fixture, harnessLog, outputDir, result }; } +const ZLIB_HASHES = { + amd64: "015be740d6236ad114582dea500c1d907f29e16d6db00566ca32fb68d71ac90d", + arm64: "209aa5cf671e97b9eb0410844fa6df4cae2e75b0c72e7802ab6c8ece13e6ddef", +} as const; +const ZLIB_VERSION = "1:1.3.dfsg+really1.3.1-1+b1"; +const zlibSnapshotUrl = (arch: keyof typeof ZLIB_HASHES) => + `https://snapshot.debian.org/archive/debian/20250810T000000Z/pool/main/z/zlib/zlib1g_1.3.dfsg%2Breally1.3.1-1%2Bb1_${arch}.deb`; + +function runZlibHarness( + architecture: keyof typeof ZLIB_HASHES, + original: { hash?: string; name?: string; version?: string } = {}, +) { + const fixture = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-zlib-")); + try { + const result = spawnSync( + "bash", + [ + "-c", + String.raw` +set -euo pipefail +fixture="$1" +verified_deb="" +mktemp() { command mktemp -d "$fixture/build.XXXXXX"; } +source "$2" "$fixture" +download() { printf '%s\n' "$1" >"$2"; } +verify_sha256() { + if [[ "$2" == *.deb ]]; then + printf '%s %s\n' "$1" "$(cat "$2")" + [[ "$1" == "$ORIGINAL_HASH" ]] || return 1 + verified_deb="$2" + fi +} +tar() { printf "#!/bin/sh\nexit 0\n" >"$4/configure"; chmod +x "$4/configure"; touch "$4/libz.so.1.3.1"; } +make() { :; } +nproc() { echo 1; } +cc() { printf '#!/bin/sh\n[ -f patched ] || exit 4\n' >write-error-test; chmod +x write-error-test; } +git() { if [[ "$2" != --check ]]; then touch patched; fi; } +gcc() { echo fixture-multiarch; } +nm() { echo 'inflate T'; } +readelf() { echo '[libz.so.1]'; } +rewrite_control_field() { printf '%s\n' "$3" >"$1"; } +refresh_md5sums() { :; } +dpkg-deb() { + if [[ "$1" == -R || ( "$1" == -f && "$2" != "$fixture/zlib1g.deb" ) ]]; then + [[ "$2" == "$verified_deb" ]] || return 64 + fi + case "$1" in + -f) case "$3" in + Package) echo "$ORIGINAL_NAME" ;; + Version) if [[ "$2" == "$fixture/zlib1g.deb" ]]; then cat "$2"; else echo "$ORIGINAL_VERSION"; fi ;; + *) return 64 ;; + esac ;; + -R) echo unpack; mkdir -p "$3/DEBIAN" "$3/usr/lib/fixture-multiarch"; touch "$3/usr/lib/fixture-multiarch/libz.so.1.3.1" ;; + --build) cp "$3/DEBIAN/control" "$4" ;; + *) return 64 ;; + esac +} +build_zlib_package "$ARCHITECTURE" +`, + "zlib-harness", + fixture, + BUILD_SCRIPT, + ], + { + encoding: "utf-8", + env: { + ...process.env, + ARCHITECTURE: architecture, + ORIGINAL_HASH: original.hash ?? ZLIB_HASHES[architecture], + ORIGINAL_NAME: original.name ?? "zlib1g", + ORIGINAL_VERSION: original.version ?? ZLIB_VERSION, + }, + }, + ); + const deb = path.join(fixture, "zlib1g.deb"); + return { + status: result.status, + stderr: result.stderr, + calls: result.stdout.trim().split("\n"), + output: fs.existsSync(deb) ? fs.readFileSync(deb, "utf-8").trim() : null, + }; + } finally { + fs.rmSync(fixture, { recursive: true, force: true }); + } +} + describe("native security package remediation", () => { + it.each(["amd64", "arm64"] as const)( + "builds zlib from the pinned %s snapshot package", + (architecture) => { + expect(runZlibHarness(architecture)).toEqual({ + status: 0, + stderr: "", + calls: [`${ZLIB_HASHES[architecture]} ${zlibSnapshotUrl(architecture)}`, "unpack"], + output: `${ZLIB_VERSION}+nemoclaw1`, + }); + }, + ); + + it.each([ + ["hash", { hash: "0".repeat(64) }], + ["package name", { name: "zlib1g-dev" }], + ["version", { version: "1:1.3.1-1" }], + ] as const)("rejects the wrong zlib %s before unpacking or building", (_, original) => { + const { status, calls, output } = runZlibHarness("arm64", original); + expect(status).toBe(1); + expect(calls).toEqual([`${ZLIB_HASHES.arm64} ${zlibSnapshotUrl("arm64")}`]); + expect(output).toBeNull(); + }); + it("keeps the package builder syntactically valid", () => { const result = spawnSync("bash", ["-n", BUILD_SCRIPT], { encoding: "utf-8" }); expect({ status: result.status, stderr: result.stderr }).toEqual({ status: 0, stderr: "" });