mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 08:37:41 +00:00
refactor(exec): split host flows and harden safe-bin trust
This commit is contained in:
@@ -54,4 +54,18 @@ describe("exec safe bin trust", () => {
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("uses startup PATH snapshot when pathEnv is omitted", () => {
|
||||
const originalPath = process.env.PATH;
|
||||
const injected = `/tmp/openclaw-path-injected-${Date.now()}`;
|
||||
const initial = getTrustedSafeBinDirs({ refresh: true });
|
||||
try {
|
||||
process.env.PATH = `${injected}${path.delimiter}${originalPath ?? ""}`;
|
||||
const refreshed = getTrustedSafeBinDirs({ refresh: true });
|
||||
expect(refreshed.has(path.resolve(injected))).toBe(false);
|
||||
expect([...refreshed].toSorted()).toEqual([...initial].toSorted());
|
||||
} finally {
|
||||
process.env.PATH = originalPath;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user