




















@@ -1,3 +1,5 @@
1+// Remote filesystem bridge tests cover SSH-style sandbox file operations using
2+// the pinned mutation helper and remote stat/path guards.
13import { spawnSync } from "node:child_process";
24import fs from "node:fs/promises";
35import path from "node:path";
@@ -13,6 +15,8 @@ function createLocalRemoteRuntime(params: {
1315remoteWorkspaceDir: string;
1416remoteAgentWorkspaceDir: string;
1517}) {
18+// Execute remote shell snippets locally so the bridge scripts are exercised
19+// without a real SSH host.
1620const calls: Array<Parameters<RemoteShellSandboxHandle["runRemoteShellScript"]>[0]> = [];
1721const runtime: RemoteShellSandboxHandle = {
1822remoteWorkspaceDir: params.remoteWorkspaceDir,
@@ -148,6 +152,8 @@ describe("remote sandbox fs bridge", () => {
148152);
149153150154it.runIf(process.platform !== "win32")("rejects symlink escapes while reading", async () => {
155+// The remote helper uses no-follow file opens; symlinked final components
156+// must fail even when the local caller cannot inspect the remote inode.
151157await withTempDir("openclaw-remote-fs-bridge-", async (stateDir) => {
152158const workspaceDir = path.join(stateDir, "workspace");
153159const outsideDir = path.join(stateDir, "outside");
@@ -183,6 +189,8 @@ describe("remote sandbox fs bridge", () => {
183189);
184190185191it("saturates unsafe stat size output without returning NaN", async () => {
192+// Remote stat output is untrusted shell text; unsafe numeric fields should
193+// clamp to deterministic values instead of leaking NaN into callers.
186194await withTempDir("openclaw-remote-fs-bridge-stat-", async (stateDir) => {
187195const workspaceDir = path.join(stateDir, "workspace");
188196await fs.mkdir(workspaceDir, { recursive: true });
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。