Repository navigation
fix(gateway): local devices stall on scope upgrade pending approval despite autoApproveLocal - #124589
Conversation
tryReadNodeList swallowed every enrichment failure, so the unfiltered nodes list silently rendered a table without connected/commands state. The fallback is now announced on stderr, keeping --json stdout parseable.
`autoApproveLocal` has documented "silently approves pairing, role upgrades, and scope upgrades from trusted local connections" since the loopback auto-approval landed, but a later hardening pass forced every scope-upgrade pairing request non-silent. That block protected nothing locally — silent initial pairing grants a fresh identity arbitrary requested scopes, so any local process could mint a new keypair instead of upgrading — while it stranded every row-authorized client (CLI, native apps, node hosts) on a manual approval no local surface could perform. Scope upgrades now ride the same silent-local rule as initial pairing, with one new restriction that encodes the real boundary: the connect must itself prove local-grade credentials (auth mode none, or the shared token/password). Identity-proxy connects (tailscale, trusted-proxy) and bearer device tokens never did, so their pairing rows remain a durable scope cap, and `autoApproveLocal: false` still forces manual approval for everything. The silent self-grant also approves the union of requested plus already-held scopes: approval merges the existing row back in, so a client requesting only its missing scope no longer fails the caller-authority check. The decision surface shrinks with the behavior change: the scope-upgrade veto contradicted shouldAllowSilentLocalPairing's answer, the CLI-container locality was a duplicate of the shared-secret-loopback predicate, and three classifiers re-derived the same shared-secret auth check. Live-verified on an isolated auth-none loopback gateway: a CLI identity paired at operator.pairing silently widens to operator.read on the next wider command, with the scope-upgrade security audit line still emitted.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 16, 2026, 9:41 AM ET / 13:41 UTC. ClawSweeper reviewWhat this changesThe PR lets locally authenticated paired Gateway devices silently widen scopes under the documented default, retains manual approval for proxy and bearer-token paths, and reports CLI node-list fallback on stderr. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessNo blocking correctness findings. Keep this protected maintainer PR open for ordinary exact-head CI completion; the updated head addresses both prior findings and preserves the stated local versus proxy/bearer-token boundary. Priority: P1 Review scores
Verification
How this fits togetherGateway device pairing evaluates a connection’s locality, authentication method, and requested scopes before admitting it or creating an approval request. The node-list CLI combines stored pairing rows with live Gateway state and now reports when live enrichment is unavailable. flowchart LR
Client[Gateway client] --> Connect[WebSocket connection]
Connect --> Policy[Pairing policy]
Policy --> Auth[Locality and authentication]
Auth --> Decision[Silent or manual approval]
Decision --> Store[Persisted device scopes]
Store --> Session[Admitted Gateway session]
Gateway[Live Gateway node state] --> CLI[Node-list CLI]
CLI --> Operator[Operator output]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -81, Tests +96, Docs 0. Total +15 across 10 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep the decision in the shared pairing-policy owner: widen only clean local connections authenticated with none, token, or password, while retaining manual approval for Do we have a high-confidence way to reproduce the issue? Yes—current main contains the unconditional scope-upgrade veto, and the branch adds focused owner-boundary reconnect coverage; this read-only review did not execute the suite. Is this the best way to solve the issue? Yes—the change repairs the shared pairing decision rather than adding a CLI-only bypass, and it keeps explicit negative boundaries for proxy and bearer-token authentication. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 81d44365ae2e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Five control-ui pairing suite cases and the silent-scope-upgrade poc locked the removed non-silent veto. The suite cases now assert the new invariant (local shared-auth upgrades widen silently, malformed and legacy-shaped rows are repaired by the fresh approval, node-then-operator grants complete without a stranded prompt), and the poc case now exercises the surviving manual-approval gate by disabling autoApproveLocal after its watcher connects, keeping the pairing-request broadcast and remediation-hint assertions alive on a real remaining path. The voice-node bootstrap failure was leakage from the aborted sibling tests, and passes again once they complete their flows.
|
Merged via squash.
|
…espite autoApproveLocal (openclaw#124589) * fix(cli): announce when nodes list degrades to paired-only data tryReadNodeList swallowed every enrichment failure, so the unfiltered nodes list silently rendered a table without connected/commands state. The fallback is now announced on stderr, keeping --json stdout parseable. * fix(gateway): silently widen local pairing scopes as documented `autoApproveLocal` has documented "silently approves pairing, role upgrades, and scope upgrades from trusted local connections" since the loopback auto-approval landed, but a later hardening pass forced every scope-upgrade pairing request non-silent. That block protected nothing locally — silent initial pairing grants a fresh identity arbitrary requested scopes, so any local process could mint a new keypair instead of upgrading — while it stranded every row-authorized client (CLI, native apps, node hosts) on a manual approval no local surface could perform. Scope upgrades now ride the same silent-local rule as initial pairing, with one new restriction that encodes the real boundary: the connect must itself prove local-grade credentials (auth mode none, or the shared token/password). Identity-proxy connects (tailscale, trusted-proxy) and bearer device tokens never did, so their pairing rows remain a durable scope cap, and `autoApproveLocal: false` still forces manual approval for everything. The silent self-grant also approves the union of requested plus already-held scopes: approval merges the existing row back in, so a client requesting only its missing scope no longer fails the caller-authority check. The decision surface shrinks with the behavior change: the scope-upgrade veto contradicted shouldAllowSilentLocalPairing's answer, the CLI-container locality was a duplicate of the shared-secret-loopback predicate, and three classifiers re-derived the same shared-secret auth check. Live-verified on an isolated auth-none loopback gateway: a CLI identity paired at operator.pairing silently widens to operator.read on the next wider command, with the scope-upgrade security audit line still emitted. * test(gateway): rewrite veto-era pairing locks for silent local widening Five control-ui pairing suite cases and the silent-scope-upgrade poc locked the removed non-silent veto. The suite cases now assert the new invariant (local shared-auth upgrades widen silently, malformed and legacy-shaped rows are repaired by the fresh approval, node-then-operator grants complete without a stranded prompt), and the poc case now exercises the surviving manual-approval gate by disabling autoApproveLocal after its watcher connects, keeping the pairing-request broadcast and remediation-hint assertions alive on a real remaining path. The voice-node bootstrap failure was leakage from the aborted sibling tests, and passes again once they complete their flows.
What Problem This Solves
Fixes an issue where local clients that pair a device — the
openclawCLI, the native desktop apps, and node hosts — would get permanently stuck onscope upgrade pending approvalwhen a later command or app update needed a wider operator scope, even on the operator's own machine withautoApproveLocalat its default. A paired device is pinned to the scopes of its first connect, scope upgrades were always forced onto the manual-approval path, and no local surface could perform that approval (openclaw devices approvefrom the same machine is itself a device that can't approve its own upgrade). The docs forgateway.nodes.pairing.autoApproveLocalhave promised "silently approves pairing, role upgrades, and scope upgrades from trusted local connections" all along — the code contradicted them.Also fixes
openclaw nodes listsilently degrading: when its live-node enrichment read failed, the table quietly dropped connected/commands state with no indication anything was missing.Why This Change Was Made
History: explicit upgrade approval was added in Feb (
0bda0202fd1), silent loopback scope upgrades were deliberately enabled three days later (9165bd7f37f), then #54694 re-blocked them globally with an empty-template PR body and no articulated threat model. The block protects nothing locally: silent initial pairing grants a fresh identity arbitrary requested scopes (that is how the macOS app acquiresoperator.admin), so any local process wanting more scopes could simply mint a new keypair instead of upgrading. Meanwhile role upgrades (node→operator, a bigger escalation) remained silent — the matrix was incoherent.Scope upgrades now ride the same silent-local rule as initial pairing, with one new restriction that encodes the boundary that actually matters: the connect must itself prove local-grade credentials (auth mode
none, or the shared token/password). Identity-proxy connects (Tailscale, trusted-proxy) and bearer device tokens never proved that, so their pairing rows remain a durable scope cap — the Tailscale Control UI cap from #124545 is regression-tested and unchanged.autoApproveLocal: falsestill forces manual approval for every access grant. The silent self-grant approves the union of requested plus already-held scopes, since approval merges the existing row back in; without that, a client requesting only its missing scope failed the caller-authority check.The decision surface shrinks with the fix: the scope-upgrade veto directly contradicted
shouldAllowSilentLocalPairing's answer (the helper has returnedtruefor local scope upgrades since February), thecli_container_locallocality classifier was a byte-for-byte duplicate of the shared-secret-loopback predicate plus a client-class check, and three classifiers re-derived the same shared-secret-auth predicate.User Impact
On your own machine, OpenClaw clients that need a wider scope just get it — no more
scope upgrade pending approvaldead ends for the CLI after its first narrow command, no stranded native apps after an update introduces a new operator scope, and dev rigs complete headlessly. Operators who want every grant reviewed keep exactly that withautoApproveLocal: false, and remote, proxied, and Tailscale clients keep today's manual-approval boundary.openclaw nodes listnow says on stderr when it degrades to paired-only data instead of silently thinning the table.Evidence
Live, on an isolated auth-none loopback gateway (own
OPENCLAW_STATE_DIR, non-default port) with a rebuilt dist:The same sequence pre-fix returned
gateway connect failed: scope upgrade pending approvaland left the row unwidened (reproduced in this session before the change). Thesecurity audit: device access upgrade requestedlog line is retained.Tests:
src/gateway/server/ws-connection/connect-device-pairing.test.ts: an auth-none CLI client and a token-auth native-app client, each paired narrow, silently widen on reconnect — deliberately requesting a non-superset so the union self-grant is covered. Both verified failing pre-fix (expected true, received falseon connect ok).none/token/password, refused fortailscale/trusted-proxy/device-token/bootstrap-token(which keepnot-paired/role-upgradebehavior unchanged), refused whenauthMethodis absent, and refused for every reason underautoApproveLocal: false.src/gateway/server/ws-connection/suite: 58 files / 593 tests green, plusserver.device-scope-upgrade, trusted-proxy auto-approve, roles-allowlist, device-token-rotate authz, node-pairing auto-approve/ssh-verify,src/infra/device-pairing, andsrc/cli/devices-clisuites.nodes listdegradation notice covered insrc/cli/program.nodes-basic.e2e.test.ts(stderr notice asserted,--jsonstdout stays clean).AbortSignal-naming errors identical on baseline); type-aware oxlint clean on changed files.Production LOC: net −44 (
handshake-auth-helpers.ts−96, veto and duplicate-predicate deletions, against +comments and the union self-grant). Tests +90. Docs:configuration-reference.mdgains the identity-proxy carve-out sentence onautoApproveLocal.