fix: unwrap env path carrier commands · openclaw/openclaw@117364e
steipete
·
2026-05-04
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -51,6 +51,7 @@ Docs: https://docs.openclaw.ai
|
51 | 51 | |
52 | 52 | - Plugins/loader: keep bundled plugin package `test-api.js` aliases behind private QA mode, so source transforms do not expose test-only public surfaces during normal plugin loading. Thanks @vincentkoc. |
53 | 53 | - Gateway/startup: start cron and record the post-ready memory trace even when deferred maintenance timers fail after readiness, so a non-fatal timer setup issue does not silently leave scheduled jobs idle. Thanks @vincentkoc. |
| 54 | +- Exec approvals: unwrap BSD/macOS `env -P <path>` carrier commands before approval-command and strict inline-eval checks, so `/approve` shell execution and inline interpreter payloads are still blocked behind that env form. |
54 | 55 | - Agents/session status: keep semantic `session_status({ sessionKey: "current" })` on the live run session even before that run has a persisted session-store entry, instead of falling back to the sandbox policy key. Thanks @vincentkoc. |
55 | 56 | - QA/Slack: resolve bundled official plugin public-surface package aliases during source-mode QA runs, so release Slack live validation can load `@openclaw/slack/api.js` without workspace symlinks. Thanks @vincentkoc. |
56 | 57 | - Codex: pass the live run session key into app-server dynamic tools when sandbox policy uses a separate session key, so `session_status({ sessionKey: "current" })` reports the active run instead of the sandbox policy key. Thanks @vincentkoc. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -337,6 +337,7 @@ describe("exec host env validation", () => {
|
337 | 337 | "env --ignore-environment /approve abc123 allow-once", |
338 | 338 | "env -i FOO=1 /approve abc123 allow-once", |
339 | 339 | "env -S '/approve abc123 deny'", |
| 340 | +"env -P /usr/bin /approve abc123 deny", |
340 | 341 | "env -iS'/approve abc123 deny'", |
341 | 342 | "env -S '/approve abc123' deny", |
342 | 343 | "env -iS'/approve abc123' deny", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -54,6 +54,9 @@ describe("command-analysis risks", () => {
|
54 | 54 | expect(detectInlineEvalArgv(["env", "-iS", "python3 -c 'print(1)'"])?.flag).toBe("-c"); |
55 | 55 | expect(detectInlineEvalArgv(["env", "-S", "python3 -c", "print(1)"])?.flag).toBe("-c"); |
56 | 56 | expect(detectInlineEvalArgv(["env", "-iSpython3 -c", "print(1)"])?.flag).toBe("-c"); |
| 57 | +expect(detectInlineEvalArgv(["env", "-P", "/usr/bin", "python3", "-c", "print(1)"])?.flag).toBe( |
| 58 | +"-c", |
| 59 | +); |
57 | 60 | expect(detectInlineEvalArgv(["command", "node", "--eval", "1"])?.flag).toBe("--eval"); |
58 | 61 | expect(detectInlineEvalArgv(["env", "-S", 'python3 -c "print(1)"'])?.flag).toBe("-c"); |
59 | 62 | expect(detectInlineEvalArgv(["python3", "script.py"])).toBeNull(); |
@@ -174,6 +177,9 @@ describe("command-analysis risks", () => {
|
174 | 177 | "bash -lc /approve abc deny", |
175 | 178 | "/approve abc deny", |
176 | 179 | ]); |
| 180 | +expect(buildCommandPayloadCandidates(["env", "-P", "/usr/bin", "/approve", "abc"])).toEqual([ |
| 181 | +"/approve abc", |
| 182 | +]); |
177 | 183 | expect(buildCommandPayloadCandidates(["exec", "-a", "openclaw", "/approve", "abc"])).toEqual([ |
178 | 184 | "/approve abc", |
179 | 185 | ]); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -11,6 +11,7 @@ const COMMAND_EXECUTING_OPTIONS = new Set(["-p"]);
|
11 | 11 | const COMMAND_QUERY_OPTIONS = new Set(["-v", "-V"]); |
12 | 12 | const ENV_OPTIONS_WITH_VALUE = new Set([ |
13 | 13 | "-C", |
| 14 | +"-P", |
14 | 15 | "-S", |
15 | 16 | "-s", |
16 | 17 | "-u", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -116,6 +116,10 @@ describe("unwrapEnvInvocation", () => {
|
116 | 116 | argv: ["env", "--chdir=/tmp", "pwsh", "-Command", "Get-Date"], |
117 | 117 | expected: ["pwsh", "-Command", "Get-Date"], |
118 | 118 | }, |
| 119 | +{ |
| 120 | +argv: ["env", "-P", "/usr/bin", "python3", "-c", "print(1)"], |
| 121 | +expected: ["python3", "-c", "print(1)"], |
| 122 | +}, |
119 | 123 | { |
120 | 124 | argv: ["env", "-S", "python3 -c", "print(1)"], |
121 | 125 | expected: ["python3", "-c", "print(1)"], |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。