Skip to content

Commit 03ec201

Browse files
committed
fix(js): update exec security test for sandbox-safe exec behavior
PR #815 made `exec cmd` run within VFS sandbox instead of blocking. The JS security test still expected `exec ls` to fail, but `ls` is a builtin that succeeds in the sandbox. Changed to test `exec /bin/bash` which correctly fails (external binary not in VFS).
1 parent f92e1af commit 03ec201

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crates/bashkit-js/__test__/security.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,11 @@ test("WB: stderr truncation on massive error output", (t) => {
120120
// 3. WHITE-BOX — Sandbox Escape Prevention (TM-ESC)
121121
// ============================================================================
122122

123-
test("WB: exec builtin blocked (TM-ESC-001)", (t) => {
123+
test("WB: exec cannot escape sandbox (TM-ESC-001)", (t) => {
124124
const bash = new Bash();
125-
const r = bash.executeSync("exec ls");
126-
t.not(r.exitCode, 0, "exec must be blocked");
125+
// exec runs commands within VFS sandbox — external binaries don't exist
126+
const r = bash.executeSync("exec /bin/bash");
127+
t.not(r.exitCode, 0, "exec of external binary must fail in sandbox");
127128
});
128129

129130
test("WB: /proc filesystem not accessible (TM-ESC-003)", (t) => {

0 commit comments

Comments
 (0)