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
9 changes: 9 additions & 0 deletions ci/reviewed-npm-audit.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@
"tarballUrl": "https://registry.npmjs.org/mcporter/-/mcporter-0.7.3.tgz",
"directory": "agents/openclaw/mcporter-runtime",
"lockSha256": "962dee34f6b0a493521d1619d1cf030e2630cbdfce8bf0598217202f57078793"
},
{
"id": "mcp-tool-discovery-runtime",
"label": "MCP tool discovery runtime locked production graph",
"packageSpec": "@modelcontextprotocol/sdk@1.30.0",
"integrity": "sha512-xKd8OIzlqNzcqcNumGAa6g+PW2kjD5vrpcKOnfldAUPP3j7lnqMPwlTXQm8gF+UwH72z0lqaRbjr9hqGz0eITA==",
"tarballUrl": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.30.0.tgz",
"directory": "tools/mcp-tool-discovery-runtime",
"lockSha256": "bc7e34d9eb1f72cf3016c8b88c72d3b7682a4f234903cb93b9476b10d7e954eb"
}
]
}
2 changes: 1 addition & 1 deletion ci/source-shape-test-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@
},
{
"file": "test/mcp-tool-discovery-image-contract.test.ts",
"test": "pins reviewed packages and retains the production audit command (#8177)",
"test": "pins reviewed packages and audits their lock outside image builds (#8253)",
"category": "security"
},
{
Expand Down
18 changes: 15 additions & 3 deletions test/mcp-tool-discovery-image-contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ const dockerfiles = [
] as const;

describe("MCP tool discovery image contract", () => {
// source-shape-contract: security -- Exact package pins and the production audit command protect the shipped runtime graph
it("pins reviewed packages and retains the production audit command (#8177)", () => {
// source-shape-contract: security -- Exact package pins and the CI audit mapping protect the shipped runtime graph
it("pins reviewed packages and audits their lock outside image builds (#8253)", () => {
const packageRoot = path.join(repoRoot, "tools", "mcp-tool-discovery-runtime");
const manifest = JSON.parse(fs.readFileSync(path.join(packageRoot, "package.json"), "utf8"));
const lock = JSON.parse(fs.readFileSync(path.join(packageRoot, "package-lock.json"), "utf8"));
const auditConfig = JSON.parse(
fs.readFileSync(path.join(repoRoot, "ci", "reviewed-npm-audit.json"), "utf8"),
);
const review = fs.readFileSync(path.join(packageRoot, "dependency-review.md"), "utf8");
const installer = fs.readFileSync(
path.join(packageRoot, "install-reviewed-runtime.sh"),
Expand Down Expand Up @@ -84,7 +87,16 @@ describe("MCP tool discovery image contract", () => {
.split(/\r?\n/)
.map((line) => line.trim())
.filter((line) => line.startsWith("npm audit")),
).toEqual(["npm audit signatures", "npm audit --omit=dev --audit-level=low"]);
).toEqual(["npm audit signatures"]);
expect(auditConfig.lockedGraphs).toContainEqual({
id: "mcp-tool-discovery-runtime",
label: "MCP tool discovery runtime locked production graph",
packageSpec: `${reviewedSdk.name}@${reviewedSdk.version}`,
integrity: reviewedSdk.integrity,
tarballUrl: reviewedSdk.resolved,
directory: "tools/mcp-tool-discovery-runtime",
lockSha256: "bc7e34d9eb1f72cf3016c8b88c72d3b7682a4f234903cb93b9476b10d7e954eb",
});
});

it.each(
Expand Down
12 changes: 10 additions & 2 deletions test/openclaw-locked-install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const TARBALL = "https://registry.npmjs.org/openclaw/-/openclaw-2026.7.1.tgz";
const LOCK_SHA256 = "759b31779f40867f35f15065b582eb1d3efb8fddb1fe43c207507c905fa2a421";
const MCPORTER_PACKAGE_SPEC = "mcporter@0.7.3";
const MCPORTER_LOCK_SHA256 = "962dee34f6b0a493521d1619d1cf030e2630cbdfce8bf0598217202f57078793";
const MCP_TOOL_DISCOVERY_PACKAGE_SPEC = "@modelcontextprotocol/sdk@1.30.0";
const MCP_TOOL_DISCOVERY_LOCK_SHA256 =
"bc7e34d9eb1f72cf3016c8b88c72d3b7682a4f234903cb93b9476b10d7e954eb";
const roots: string[] = [];

function sha256(file: string): string {
Expand Down Expand Up @@ -382,12 +385,17 @@ describe("locked OpenClaw production installation (#5896)", () => {
lockSha256: MCPORTER_LOCK_SHA256,
packageSpec: MCPORTER_PACKAGE_SPEC,
}),
expect.objectContaining({
directory: "tools/mcp-tool-discovery-runtime",
lockSha256: MCP_TOOL_DISCOVERY_LOCK_SHA256,
packageSpec: MCP_TOOL_DISCOVERY_PACKAGE_SPEC,
}),
]),
);
expect(audit.lockedGraphs).toHaveLength(2);
expect(audit.lockedGraphs).toHaveLength(3);
expect(
audit.lockedGraphs.map(({ packageSpec }: { packageSpec?: string }) => packageSpec).sort(),
).toEqual([MCPORTER_PACKAGE_SPEC, PACKAGE_SPEC].sort());
).toEqual([MCPORTER_PACKAGE_SPEC, MCP_TOOL_DISCOVERY_PACKAGE_SPEC, PACKAGE_SPEC].sort());
for (const graph of audit.lockedGraphs) {
expect(graph).not.toHaveProperty("replacementLockSha256");
expect(graph).not.toHaveProperty("reviewedLockSha256");
Expand Down
14 changes: 10 additions & 4 deletions tools/mcp-tool-discovery-runtime/dependency-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ The shared image runtime uses the official `@modelcontextprotocol/sdk` client so
- `ip-address@10.3.1`: `sha512-1e9d3kb97NHJTIJDZW9rKqW2h6+dFa50Dy0fpPSMQp2ADje5gvKsXmdiK6dwY5t76TaTt5+P5N1Y/LoToIxP6g==`

OpenClaw's `mcporter` dependency graph also resolves the official SDK but remains separately locked. This runtime keeps a direct lock because Hermes and LangChain Deep Agents Code must not depend on OpenClaw's adapter package.
The client bundle includes the SDK's AJV validation path, including `ajv-formats` and `fast-uri`, plus `content-type` for standards-compliant response media-type parsing. The `fast-uri` override and `content-type` license are therefore runtime-relevant. The bundle does not include the SDK's Hono server adapter or its `hono` and `ip-address` dependencies, but those packages remain part of the installed production graph that the image build audits. The build enforces the exact reviewed bundle-package allowlist and emits `BUNDLED_PACKAGES.json` alongside the generated third-party license notice. The exact overrides keep the installed graph outside the affected ranges for `GHSA-7p8r-x3mc-p8w7`, `GHSA-8j4g-w8fx-2239`, `GHSA-mwp4-54f8-5fhr`, `GHSA-4xrf-jv44-h6hh`, and `GHSA-22jq-vg5j-6vgg` without changing the SDK client pin.
The client bundle includes the SDK's AJV validation path, including `ajv-formats` and `fast-uri`, plus `content-type` for standards-compliant response media-type parsing. The `fast-uri` override and `content-type` license are therefore runtime-relevant. The bundle does not include the SDK's Hono server adapter or its `hono` and `ip-address` dependencies, but those packages remain part of the installed production graph that the reviewed npm audit CI check evaluates. The build enforces the exact reviewed bundle-package allowlist and emits `BUNDLED_PACKAGES.json` alongside the generated third-party license notice. The exact overrides keep the installed graph outside the affected ranges for `GHSA-7p8r-x3mc-p8w7`, `GHSA-8j4g-w8fx-2239`, `GHSA-mwp4-54f8-5fhr`, `GHSA-4xrf-jv44-h6hh`, and `GHSA-22jq-vg5j-6vgg` without changing the SDK client pin.

## 2026-08-03 security refresh

The NemoClaw `v0.0.100` sandbox image build stopped before creating an image because the committed runtime lock resolved three packages in newly reported advisory ranges.
NemoClaw `main` at `3f3eb6139e089c24397d6a499a10fcde4bdc84da` reproduced the same failure.
The audit boundary worked as designed and remains unchanged.
At that revision, the image-build audit boundary worked as designed.
Issue #8177 records the source, build run, failure receipt, and resume condition.

Registry metadata binds each audited range:
Expand All @@ -42,7 +42,13 @@ Concern ledger:
- `MCP-AUDIT-1` — `fast-uri@3.1.4` accepts malformed or whitespace-smuggled authority introducers that can produce host confusion. Surface: executable AJV format validation in the bundled client. Resolution: pin `fast-uri@3.1.5`, which rejects the ambiguous forms and adds regression tests for them. Validation: exact lock metadata, `npm test`, bundle verification, and the production audit.
- `MCP-AUDIT-2` — `hono@4.12.30` uses a regular expression that can cause excessive work for a large CORS request-header value. Surface: installed SDK server dependency; excluded from the client bundle. Resolution: pin `hono@4.12.34`, which replaces the split expression and adds a regression test for a large request header. Validation: exact lock metadata, bundle-input exclusion, and the production audit.
- `MCP-AUDIT-3` — `ip-address@10.2.0` accepts address forms whose classification can differ across parsers. Surface: installed SDK server dependency; excluded from the client bundle. Resolution: pin `ip-address@10.3.1`, which rejects leading-zero IPv4 octets and stacked subnet suffixes and adds regression tests for IPv4 and IPv6 parsing. Validation: exact lock metadata, bundle-input exclusion, and the production audit.
- `MCP-AUDIT-4` — A dependency-only remediation could weaken the image build's fail-closed audit boundary. Surface: `install-reviewed-runtime.sh`. Resolution: retain `npm audit --omit=dev --audit-level=low` and bind it with the reviewed manifest and lock in the image contract test. Validation: `test/mcp-tool-discovery-image-contract.test.ts`.
- `MCP-AUDIT-4` — A live advisory query in the image build can prevent a released version from creating the same image after npm publishes a new advisory. Surface: `install-reviewed-runtime.sh`. Resolution: keep registry signature verification in the image build and move production advisory enforcement for this exact lock to the reviewed npm audit CI check. Validation: `test/mcp-tool-discovery-image-contract.test.ts`.

## 2026-08-05 build audit boundary update

Issue #8253 showed that the image-build audit made sandbox creation depend on npm's current advisory data instead of only the committed build inputs. The shared installer no longer runs the live production advisory query. It still installs the exact lock with lifecycle scripts disabled, verifies registry signatures, runs the runtime tests and typecheck, and verifies the exact bundle inputs.

The reviewed npm audit CI check now owns production advisory enforcement for this lock. It verifies the lock SHA-256 and SDK package integrity, installs the production graph with lifecycle scripts disabled, records audit provenance and policy results, verifies registry signatures, and fails on unaccepted findings at the repository's configured threshold.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

## 1.29.0 to 1.30.0 migration review

Expand Down Expand Up @@ -70,7 +76,7 @@ The reviewed archive is `https://registry.npmjs.org/@hono/node-server/-/node-ser
Every agent image installs this committed graph with `npm ci --ignore-scripts` through the same reviewed installer, verifies registry signatures, typechecks the package against the real SDK types, and produces a single Node.js ESM bundle. Only that bundle, its checked package manifest, and a deterministic notice containing the license text for every package in esbuild's actual input graph are copied into the final image; the build dependency tree is discarded with the builder stage. This preserves the official SDK implementation and its license obligations while avoiding a large production layer composed of thousands of small package files.
The installer applies the existing public corporate CA build argument to npm TLS when present.
The root CLI TypeScript project excludes only this dependency-owning image entry point; the image package's dedicated `tsconfig.json` is the source-of-truth type gate, while the dependency-free core remains covered by the root project and host tests.
The image build requires a clean low-severity production advisory audit, verified npm registry signatures, the case-variant SSE session test, a root-owned non-writable bundled runtime, and an executable invalid-input contract check before the image can complete.
The image build requires verified npm registry signatures, the case-variant SSE session test, a root-owned non-writable bundled runtime, and an executable invalid-input contract check before the image can complete. The reviewed npm audit CI check separately evaluates the locked production graph against the repository's advisory policy.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

Review evidence on 2026-07-14:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,3 @@ npm audit signatures
npm test
npm run typecheck
npm run bundle
npm audit --omit=dev --audit-level=low
Loading