Skip to content

fix: bind macOS node allowlist commands safely - #104337

Merged
steipete merged 2 commits into
mainfrom
codex/fix-macos-node-login-shell
Jul 11, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/fix-macos-node-login-shell

Conversation

@steipete

@steipete steipete commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Mac App nodes using security=allowlist reject exact executable approvals from the agent's standard node_exec path. The caller wraps macOS commands in a login shell, while the Mac host correctly refuses to reuse approval through login startup files.

Fixes #104330.

Why This Change Was Made

Use the Mac host's existing safe binding contract: /bin/sh -c for a static macOS payload. The Mac App can then resolve and bind the exact approved executable before execution. Windows remains on cmd.exe; Linux and unknown POSIX nodes retain /bin/sh -lc to avoid expanding this compatibility change beyond the proven regression.

The platform match covers both Node's darwin identifier and the Mac App's versioned macOS 26.5.2-style metadata.

User Impact

  • Before: an exact /bin/hostname Mac-node approval still returned SYSTEM_RUN_DENIED: allowlist miss.
  • After: the standard agent node-exec command binds to and runs the approved executable.
  • Login startup files remain outside reusable authorization.

Evidence

  • Blacksmith Testbox tbx_01kx86ejmwtkvgcj5b3zf4qp0a: corepack pnpm test src/infra/node-shell.test.ts — 3 passed.
  • Blacksmith Testbox tbx_01kx86hredg07pjg317k793t2n: touched-file check:changed — passed.
  • Fresh autoreview: clean, no accepted/actionable findings, confidence 0.97.
  • Live Gateway + Mac App proof on the same megaclaw allowlist policy:
    • /bin/sh -lc /bin/hostname with raw command /bin/hostname — denied as allowlist miss.
    • /bin/sh -c /bin/hostname with the same raw command — exit 0, stdout megaclaw.

Changes

  • src/infra/node-shell.ts: select non-login shell transport for darwin and versioned macOS node metadata.
  • src/infra/node-shell.test.ts: cover real Mac App metadata and preserve other-platform behavior.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Jul 11, 2026
@clawsweeper

clawsweeper Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 11, 2026, 5:23 AM ET / 09:23 UTC.

Summary
The PR changes macOS node command wrapping from login-shell /bin/sh -lc to bindable /bin/sh -c and adds focused platform-selection tests.

PR surface: Source +5, Tests +5. Total +10 across 2 files.

Reproducibility: yes. Current source constructs the rejected /bin/sh -lc transport, Mac host tests establish that only static /bin/sh -c is reusable, and the PR reports a live current-behavior denial followed by successful execution with the proposed transport.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #104330
Summary: This PR is the direct candidate fix for the linked open issue and should remain paired with it until merge.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] Merging intentionally changes every macOS node command from a login shell to a non-login shell, so commands that implicitly relied on login startup files or profile-modified PATH may behave differently; repository docs already state that node exec does not use OpenClaw's shell-startup snapshot, but CI does not fully settle external profile dependence.

Maintainer options:

  1. Accept the safer Mac transport (recommended)
    Land after explicitly accepting that macOS node commands no longer source login startup files and should use explicit executable paths or the node process environment.
  2. Negotiate transport by capability
    Pause the PR and carry an explicit host capability or policy signal so only reusable allowlist execution selects the non-login transport.

Next step before merge

  • The code needs no automated repair; a likely owner should explicitly accept the platform-wide non-login-shell compatibility effect and then land the paired fix.

Maintainer decision needed

  • Question: Should macOS node execution intentionally stop loading login-shell startup files so exact allowlist approvals can bind safely?
  • Rationale: The shared constructor receives platform metadata but not the node’s security policy, so the safe focused fix changes shell initialization for all macOS node execution rather than allowlist mode alone.
  • Likely owner: steipete — Feature history connects this person to both the node execution route and the recent Mac authorization hardening that created the intended contract.
  • Options:
    • Accept non-login macOS transport (recommended): Land the focused patch and make the host’s safe reusable-binding contract authoritative for Mac node execution.
    • Add policy-aware negotiation: Pause and introduce a capability or policy signal before selecting sh -c, accepting the added protocol and compatibility surface.

Security
Cleared: The patch adds no dependency or supply-chain surface and preserves the Mac host’s fail-closed executable resolution, payload matching, and unsafe-target checks.

Review details

Best possible solution:

Land the platform-specific non-login transport while preserving the Mac host’s strict static-command binding checks and treating profile-dependent node commands as unsupported rather than weakening authorization.

Do we have a high-confidence way to reproduce the issue?

Yes. Current source constructs the rejected /bin/sh -lc transport, Mac host tests establish that only static /bin/sh -c is reusable, and the PR reports a live current-behavior denial followed by successful execution with the proposed transport.

Is this the best way to solve the issue?

Yes, subject to explicit acceptance of the compatibility effect. Selecting the Mac host’s already-supported transport at the existing platform-aware constructor is narrower and safer than weakening reusable-authorization checks or adding a second execution path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against adb05e72dc0f.

Label changes

Label changes:

  • add P1: This PR addresses a current Mac App regression that prevents exact approved executables from running through the standard agent node-exec workflow.
  • add merge-risk: 🚨 compatibility: The branch changes shell initialization for all macOS node commands, potentially affecting profile-dependent environment and PATH behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix live Gateway and Mac App output showing the exact changed behavior under one allowlist policy, plus focused Testbox and changed-file validation.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes after-fix live Gateway and Mac App output showing the exact changed behavior under one allowlist policy, plus focused Testbox and changed-file validation.

Label justifications:

  • P1: This PR addresses a current Mac App regression that prevents exact approved executables from running through the standard agent node-exec workflow.
  • merge-risk: 🚨 compatibility: The branch changes shell initialization for all macOS node commands, potentially affecting profile-dependent environment and PATH behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes after-fix live Gateway and Mac App output showing the exact changed behavior under one allowlist policy, plus focused Testbox and changed-file validation.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix live Gateway and Mac App output showing the exact changed behavior under one allowlist policy, plus focused Testbox and changed-file validation.
Evidence reviewed

PR surface:

Source +5, Tests +5. Total +10 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 0 +5
Tests 1 7 2 +5
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 12 2 +10

What I checked:

  • Current-main mismatch: Current main sends every non-Windows node command through /bin/sh -lc, including macOS, while the Mac host deliberately refuses reusable authorization for login-shell transports. (src/infra/node-shell.ts:12, adb05e72dc0f)
  • Mac authorization contract: The host binds only a static three-argument sh -c wrapper whose parsed payload exactly matches one resolved argv; login shells and unsafe targets remain fail-closed. (apps/macos/Sources/OpenClaw/ExecCommandResolution.swift:122, 839892e4c404)
  • Correct owner boundary: The node execution preparation path already passes the selected node platform into the shared shell constructor, so platform-specific transport selection belongs at the changed helper rather than in Mac authorization code. (src/agents/bash-tools.exec-host-node-phases.ts:328, adb05e72dc0f)
  • Focused branch behavior: The branch selects /bin/sh -c only for normalized darwin or macOS metadata and preserves cmd.exe for Windows plus /bin/sh -lc for other or unknown POSIX platforms. (src/infra/node-shell.ts:12, 4c4ab54ba27e)
  • Regression coverage: The focused tests cover darwin, plain and versioned Mac App metadata, Windows labels, Linux, and missing platform values. (src/infra/node-shell.test.ts:30, 4c4ab54ba27e)
  • Real behavior proof: The PR body reports a live Gateway and Mac App comparison under the same allowlist policy: the exact executable is denied through sh -lc and exits successfully through sh -c; it also records focused Testbox and changed-file checks. (4c4ab54ba27e)

Likely related people:

  • steipete: History connects the original node host-routing work and the recent macOS execution-authorization hardening to this person. (role: feature introducer and recent authorization-path contributor; confidence: high; commits: ae0b4c49903d, 9b1c36d23c3f; files: src/agents/bash-tools.exec-host-node-phases.ts, apps/macos/Sources/OpenClaw/ExecCommandResolution.swift, apps/macos/Sources/OpenClaw/NodeMode/MacNodeRuntime.swift)
  • vincentkoc: Current blame and history attribute the checked-in shared node-shell constructor and reusable Mac binding implementation to recent integration work by this contributor. (role: recent current-main integrator; confidence: medium; commits: 839892e4c404, ccab708c1633; files: src/infra/node-shell.ts, src/agents/bash-tools.exec-host-node-phases.ts, apps/macos/Sources/OpenClaw/ExecCommandResolution.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 11, 2026
@steipete
steipete merged commit 6e81c54 into main Jul 11, 2026
140 of 144 checks passed
@steipete
steipete deleted the codex/fix-macos-node-login-shell branch July 11, 2026 09:28
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 12, 2026
* fix: bind macOS node allowlist commands safely

* chore: leave node fix notes in PR
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Jul 15, 2026
* fix: bind macOS node allowlist commands safely

* chore: leave node fix notes in PR

(cherry picked from commit 6e81c54)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mac App node allowlists reject agent node_exec login-shell transport

1 participant