Skip to content

Commit 136eab0

Browse files
test(dispatch-wrapper): preserve utility operand boundaries (#98657)
Keep durable exec approval analysis aligned with the utility operand that actually runs. Add regression coverage for valid and invalid flock separator placement and the BSD script transcript operand. Co-authored-by: Ayaan Zaidi <[email protected]>
1 parent 81d7f54 commit 136eab0

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎src/infra/exec-wrapper-resolution.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ describe("unwrapKnownDispatchWrapperInvocation", () => {
262262
argv: ["flock", "/tmp/openclaw.lock", "-c", "echo hi"],
263263
expected: { kind: "blocked", wrapper: "flock" },
264264
},
265+
{
266+
argv: ["flock", "/tmp/openclaw.lock", "--", "bash", "-lc", "echo hi"],
267+
expected: { kind: "blocked", wrapper: "flock" },
268+
},
265269
{
266270
argv: ["flock", "-un", "/tmp/openclaw.lock", "bash", "-lc", "echo hi"],
267271
expected: { kind: "blocked", wrapper: "flock" },
@@ -286,6 +290,15 @@ describe("unwrapKnownDispatchWrapperInvocation", () => {
286290
expect(unwrapKnownDispatchWrapperInvocation(argv)).toEqual(expected);
287291
});
288292

293+
test("keeps the transcript operand after the script option separator", () => {
294+
expect(
295+
unwrapKnownDispatchWrapperInvocation(
296+
["script", "--", "/tmp/session.log", "bash", "-lc", "echo hi"],
297+
"darwin",
298+
),
299+
).toEqual({ kind: "unwrapped", wrapper: "script", argv: ["bash", "-lc", "echo hi"] });
300+
});
301+
289302
test("blocks arch dispatch unwrapping outside macOS", () => {
290303
expect(
291304
unwrapKnownDispatchWrapperInvocation(["arch", "-arm64", "bash", "-lc", "echo hi"], "linux"),
@@ -396,6 +409,11 @@ describe("resolveDispatchWrapperTrustPlan", () => {
396409
wrapper: "flock",
397410
effectiveArgv: ["bash", "-lc", "echo hi"],
398411
},
412+
{
413+
argv: ["flock", "--", "/tmp/openclaw.lock", "bash", "-lc", "echo hi"],
414+
wrapper: "flock",
415+
effectiveArgv: ["bash", "-lc", "echo hi"],
416+
},
399417
{
400418
argv: ["timeout", "--signal=TERM", "5s", "bash", "-lc", "echo hi"],
401419
wrapper: "timeout",

0 commit comments

Comments
 (0)