Skip to content

fix(exec): allowlisted scripts can't be steered into leaking secret keys - #174

Merged
cryptolir merged 1 commit into
mainfrom
fix/exec-allowlist-secret-keys
Sep 30, 2026
Merged

cryptolir merged 1 commit into
mainfrom
fix/exec-allowlist-secret-keys

Conversation

@cryptolir

Copy link
Copy Markdown
Owner

Plan: cryptolir/openclaw-dashboard docs/plans/active/exec-secret-keys.md (openclaw#666, approved by the owner 2026-09-30, internal review folded).

The hole (allowlist mode, gateway host): an allowlisted command ran through sh -c with the gateway's whole environment, and $VAR passed the analysis. So gmail.py send --body "$GMAIL_APP_PASSWORD" mailed a key. The model's env was also merged in, which let it point hubspot.py at another host.

The fix:

  • Literal arguments (I41): every allowlist-satisfied command runs as its analyzed argv, single-quoted. It reuses buildSafeBinsShellCommand with a new quoteAll; a command that can't be rendered is refused.
  • No model env (I42): the model's env is dropped when the enforced security is allowlist, with a warning in the result.
  • Per-script keys (I43): new tools.exec.scriptEnv: all (default, today's behavior), report (logs key names only), or declared. declared passes only the always-passed names, the outreach identity and the script's skill keys (requires.env, primaryEnv, and a new optional metadata.openclaw.env).

Tests:

  • New pi-tools.exec-secret-keys.e2e.test.ts uses a real allowlisted probe script: 5/5 pass, and 4 of them fail with the fix removed.
  • Related existing tests pass: safe-bins, path, exec and approval e2e (35), and exec-approvals, outreach-identity, script-preflight, config and skills unit tests (501).
  • tsgo: no errors in src/. oxfmt and oxlint are clean on the changed files.

Scope: only agents with security=allowlist and an allowlist, which today are the 8 DevAgents agents. Production agents have no allowlist, so nothing changes there.

🤖 Generated with Claude Code

In allowlist mode on the gateway host:
- every allowlist-satisfied command runs as its analyzed argv, single-quoted (buildSafeBinsShellCommand
  with quoteAll), so "$SECRET", ~, globs and braces reach the script as text, never as values;
- the model's env parameter is dropped, so it can't point a script's key at another host;
- tools.exec.scriptEnv (all | report | declared): "declared" passes only PATH/HOME/locale-type names,
  the outreach identity, and the keys the script's skill declares (requires.env, primaryEnv, env).

Plan: openclaw-dashboard docs/plans/active/exec-secret-keys.md (openclaw#666). Default behavior outside
allowlist mode is unchanged; production agents have no allowlists.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cryptolir
cryptolir merged commit be5cf9b into main Sep 30, 2026
19 of 24 checks passed
@cryptolir
cryptolir deleted the fix/exec-allowlist-secret-keys branch September 30, 2026 11:24
cryptolir added a commit that referenced this pull request Sep 30, 2026
cryptolir pushed a commit that referenced this pull request Oct 10, 2026
…scriptEnv; fleet snapshot

- AGENTS.md (CLAUDE.md is a symlink to it) and the gateway release runbook
  told sessions to roll prod with `deploy.sh <tag> all`, which rolls every
  Agent on a server, pilots and stopped ones included (#179 review). Prod
  rolls are the owner's per-Agent dashboard Upgrade (dashboard openclaw#690).
- Core API key list now points to dashboard TERMINOLOGY.md (it had 4 of 7).
- configuration-reference: tools.exec.scriptEnv (#174) was undocumented.
- INFRASTRUCTURE.md: dev row and §6 fleet from today's docker ps (was June).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cryptolir added a commit that referenced this pull request Oct 10, 2026
…eet snapshot (2026-10-10) (#181)

* docs(status): refresh to 2026-10-10 — open work only, follow-ups, fleet and deploy rules

The claimed-branches table had 21 rows, many still "open" or "in review"; all but
dashboard openclaw#639 had merged. Merged rows leave the table, their loose ends
move to a short follow-up list (checked against the hosts today). The
duplicate May-era branch table and Currently In Progress list go. Deploy
Rules now name the dashboard Upgrade for prod rolls, not deploy.sh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: prod Agents roll by the dashboard Upgrade; document tools.exec.scriptEnv; fleet snapshot

- AGENTS.md (CLAUDE.md is a symlink to it) and the gateway release runbook
  told sessions to roll prod with `deploy.sh <tag> all`, which rolls every
  Agent on a server, pilots and stopped ones included (#179 review). Prod
  rolls are the owner's per-Agent dashboard Upgrade (dashboard openclaw#690).
- Core API key list now points to dashboard TERMINOLOGY.md (it had 4 of 7).
- configuration-reference: tools.exec.scriptEnv (#174) was undocumented.
- INFRASTRUCTURE.md: dev row and §6 fleet from today's docker ps (was June).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(status): dashboard openclaw#639 merged today; drop its row

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Liran Peretz <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant