Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion agents/hermes/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ PY
# file has to also rewrite the Dockerfile-committed hash, which reviewers gate).
# Regenerate with `sha256sum agents/hermes/{hermes-wrapper.py,validate-env-secret-boundary.py,finalize-tirith-marker.py}`.
ARG NEMOCLAW_HERMES_WRAPPER_SHA256=ec8b0e4d6254175929d5a02240acd6af25e94774a30b36ba5c6f5a69c32fb9d7
ARG NEMOCLAW_HERMES_VALIDATOR_SHA256=d7371a84099b204346e0bfecfacb0086fdab690e5fadcf5e12417b6038927d19
ARG NEMOCLAW_HERMES_VALIDATOR_SHA256=3d9c099bfd06912fa0a4688e113555654e0952224c4226ad5f8c68b59c34895b
ARG NEMOCLAW_HERMES_TIRITH_FINALIZER_SHA256=a1e6b1c53ab297569abb87c29d15c294d729e46005bfd022136b4c447a791819
# hadolint ignore=DL4006
RUN printf '%s %s\n' \
Expand Down
5 changes: 5 additions & 0 deletions ci/source-shape-test-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@
"test": "requires classifier review and integrity evidence when the OpenClaw build pin changes",
"category": "security"
},
{
"file": "test/hermes-final-image-layout.test.ts",
"test": "keeps security entrypoint hashes synchronized with the copied files",
"category": "security"
},
{
"file": "test/hermes-runtime-config-guard-topology.test.ts",
"test": "restores exact locked posture after root-separated repair and later failure (#7033)",
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/live/issue-6194-tui-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ send -i $termSpawn -- "\\t"
after 200
expect_exact_or_exit $termSpawn $sandbox openshell_sandbox_listed 66 67
send -i $termSpawn -- "\\r"
expect_exact_or_exit $termSpawn {Name:} openshell_sandbox_detail 68 69
# Ratatui may update the "Name:" label as separate terminal diffs. Wait for a
# stable detail-panel heading, then still bind the view to the exact sandbox.
expect_exact_or_exit $termSpawn {Filesystem Access} openshell_sandbox_detail 68 69
expect_exact_or_exit $termSpawn $sandbox openshell_sandbox_detail_name 70 71
# OpenShell documents 'r' as the Network Rules focus key in sandbox detail.
send -i $termSpawn -- "r"
Expand Down
9 changes: 8 additions & 1 deletion test/e2e/live/mcp-bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ async function onboardAgent(
host: HostCliClient,
cleanup: CleanupRegistry,
endpointUrl: string,
options: { agent: McpAgent; sandboxName: string; artifactName: string },
options: {
agent: McpAgent;
sandboxName: string;
artifactName: string;
envOverlay?: NodeJS.ProcessEnv;
},
): Promise<void> {
cleanup.trackSandbox(host, options.sandboxName, {
artifactName: "cleanup-destroy-sandbox",
Expand All @@ -133,6 +138,7 @@ async function onboardAgent(
artifactName: options.artifactName,
env: {
...buildAvailabilityProbeEnv(),
...options.envOverlay,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
COMPATIBLE_API_KEY: COMPATIBLE_KEY,
NVIDIA_INFERENCE_API_KEY: COMPATIBLE_KEY,
NEMOCLAW_AGENT: options.agent,
Expand Down Expand Up @@ -1374,6 +1380,7 @@ mcpBridgeShardTest("deepagents")(
agent: "langchain-deepagents-code",
sandboxName: DEEPAGENTS_SANDBOX_NAME,
artifactName: "onboard-deepagents-mcp-bridge",
envOverlay: exactMainProof.envOverlay,
});
await exactMainProof.afterOnboard();
cleanup.add("remove Deep Agents MCP bridge", () =>
Expand Down
1 change: 1 addition & 0 deletions test/e2e/live/openshell-exact-main-mcp-proof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function prepareExactMainMcpProof(
const { artifacts, cleanup, host, sandbox } = fixture;
const driverConfig = prepareExactMainDriverConfigProof(fixture, sandboxName);
return {
envOverlay: driverConfig.envOverlay,
async afterOnboard(): Promise<void> {
await driverConfig.assertAfterOnboard();
await assertExactMainOpenShellContracts(host, sandboxName);
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/support/issue-6194-tui-post-idle-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ describe("live TUI post-idle coverage contract (#6194)", () => {
);
expect(script.match(/send -i \$termSpawn -- "\\t"/gu) ?? []).toHaveLength(2);
expect(script).toContain(
"expect_exact_or_exit $termSpawn {Name:} openshell_sandbox_detail 68 69",
"expect_exact_or_exit $termSpawn {Filesystem Access} openshell_sandbox_detail 68 69",
);
expect(script).not.toContain("expect_exact_or_exit $termSpawn {Name:}");
expect(script).not.toContain("(Dashboard-)?Sandbox:");
expect(script).toContain('send -i $termSpawn -- "r"');
expect(script).toContain(
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/support/mcp-bridge-sandbox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ network_policies:

it("runs the zero-upstream rebinding proof for all three adapters", () => {
const source = fs.readFileSync("test/e2e/live/mcp-bridge.test.ts", "utf8");
const exactMainProofSource = fs.readFileSync(
"test/e2e/live/openshell-exact-main-mcp-proof.ts",
"utf8",
);

expect(source.match(/await assertAdapterDnsRebindingDenied/g)).toHaveLength(3);
for (const adapter of [
Expand All @@ -315,6 +319,8 @@ network_policies:
}
expect(source).toContain("rebound request must not reach the upstream MCP server");
expect(source).toContain(").toHaveLength(0);");
expect(exactMainProofSource).toContain("envOverlay: driverConfig.envOverlay");
expect(source).toContain("envOverlay: exactMainProof.envOverlay");
});

it("restores the DNS fixture before MCP removal can restart the sandbox", () => {
Expand Down
35 changes: 35 additions & 0 deletions test/hermes-final-image-layout.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

import { createHash } from "node:crypto";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
Expand All @@ -9,6 +10,23 @@ import { dockerRunCommandBetween, runDockerShell } from "./helpers/hermes-docker

const ROOT = path.resolve(import.meta.dirname, "..");
const HERMES_DOCKERFILE = path.join(ROOT, "agents", "hermes", "Dockerfile");
const HERMES_INTEGRITY_FILES = [
{
arg: "NEMOCLAW_HERMES_WRAPPER_SHA256",
source: "agents/hermes/hermes-wrapper.py",
target: "/usr/local/lib/nemoclaw/hermes-wrapper.py",
},
{
arg: "NEMOCLAW_HERMES_VALIDATOR_SHA256",
source: "agents/hermes/validate-env-secret-boundary.py",
target: "/usr/local/lib/nemoclaw/validate-hermes-env-secret-boundary.py",
},
{
arg: "NEMOCLAW_HERMES_TIRITH_FINALIZER_SHA256",
source: "agents/hermes/finalize-tirith-marker.py",
target: "/usr/local/lib/nemoclaw/finalize-tirith-marker.py",
},
] as const;

type LegacyDataFixture =
| "none"
Expand Down Expand Up @@ -108,6 +126,23 @@ function runFinalLayout({
}

describe("Hermes final image layout", () => {
// source-shape-contract: security -- Exact source-to-image digests keep the reviewed Hermes runtime entrypoints bound to the files copied into the sandbox image
it("keeps security entrypoint hashes synchronized with the copied files", () => {
const dockerfile = fs.readFileSync(HERMES_DOCKERFILE, "utf-8");

for (const entry of HERMES_INTEGRITY_FILES) {
const digest = createHash("sha256")
.update(fs.readFileSync(path.join(ROOT, entry.source)))
.digest("hex");
const declaredDigest = dockerfile.match(
new RegExp(`^ARG ${entry.arg}=([0-9a-f]{64})$`, "mu"),
)?.[1];

expect(dockerfile).toContain(`COPY ${entry.source} ${entry.target}`);
expect(declaredDigest, `${entry.arg} must match ${entry.source}`).toBe(digest);
}
});

it("rejects retired OpenClaw state represented as a directory", () => {
const run = runFinalLayout({ openclaw: "directory" });
try {
Expand Down
Loading