fix(exec): scope reusable approvals to their working directory (#129636)

* fix(exec): bind durable approvals to working directory

* chore(apps): refresh native string inventory

* test(node-host): preserve prepared working directory

* fix(exec): use shared path safety facade

* fix(exec): revalidate approved directory identity
This commit is contained in:
Josh Avant
2026-08-25 18:24:14 -07:00
committed by GitHub
parent 4c4152e71d
commit 1c37c8cdc7
44 changed files with 1258 additions and 313 deletions
+5
View File
@@ -90,6 +90,10 @@ openclaw approvals resolve <id> allow-always
openclaw approvals resolve <id> deny --reason "Not expected during maintenance"
```
For exec requests, `allow-always` means **always allow here**: the generated
grant is tied to the command's exact arguments and current working directory.
The same command from another directory requires a separate approval.
The CLI reads the unified approval record to select its kind, checks the requested decision against the record's allowed decisions, and then calls the unified resolver. A first successful decision exits `0`. Repeating the recorded decision also exits `0` and reports `already resolved (same decision)`. A conflicting decision, missing approval, expired approval, or decision unavailable for that approval kind prints a clear error and exits non-zero.
`--reason` adds a local note to the CLI confirmation. The current Gateway approval record has no free-text resolution-reason field, so this note is not persisted or sent to other approval surfaces.
@@ -183,6 +187,7 @@ No target flag means the local approvals row in the shared state database.
## Notes
- The node host must advertise `system.execApprovals.get/set` (macOS app, headless node host, or Windows companion).
- After upgrading from an argv-only generated-grant version, run `openclaw doctor --fix` if the update did not already do so. Doctor removes only inactive generated grants; manual allowlist rules stay in place. Rerun affected workflows to approve them in the intended directory.
- Approvals are stored per host in
`$OPENCLAW_STATE_DIR/state/openclaw.sqlite#exec_approvals_config`, or
`~/.openclaw/state/openclaw.sqlite#exec_approvals_config` when the variable is
+7
View File
@@ -38,6 +38,13 @@ Doctor has five postures:
Use `openclaw doctor --json` when an operator or script wants the advisory Doctor report as JSON. It exits successfully after producing a report; inspect `ok` and `findings` for health state. Use explicit `openclaw doctor --lint --json` when CI should exit nonzero for findings at the selected severity threshold. Prefer `--fix` when a human operator wants Doctor to edit config or state.
After an exec-approval format upgrade, Doctor reports older generated approvals
that are no longer active because they were not tied to a working directory.
`openclaw doctor --fix` removes those inactive generated entries and leaves
manual allowlist rules unchanged. Rerun affected workflows and choose
**Always allow here** to renew trust for the intended directory. The normal
`openclaw update` finalization runs this safe repair automatically.
## Examples
```bash