Security: block exec host overrides under auto target

This commit is contained in:
Vincent Koc
2026-04-01 18:13:15 +09:00
committed by Peter Steinberger
parent 5874a387ae
commit dae6632da1
3 changed files with 23 additions and 14 deletions

View File

@@ -47,19 +47,15 @@ describe("resolveExecTarget", () => {
({ resolveExecTarget } = await import("./bash-tools.exec-runtime.js"));
});
it("treats auto as a default strategy rather than a host allowlist", () => {
expect(
it("rejects host overrides when configured host is auto", () => {
expect(() =>
resolveExecTarget({
configuredTarget: "auto",
requestedTarget: "node",
elevatedRequested: false,
sandboxAvailable: false,
}),
).toMatchObject({
configuredTarget: "auto",
selectedTarget: "node",
effectiveHost: "node",
});
).toThrow("exec host not allowed");
});
});