Repository navigation
feat(gateway): connect approved trusted-proxy CLI and TUI devices within their grant - #199699
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
✅ Maintainer security changes approvedA maintainer approved this revision with an explicit security approval comment.
A later push requires a fresh approval comment for an external contributor's PR. |
|
Codex review: blocked before merge. What this changesAdds an opt-in setting that connects approved trusted-proxy terminal devices within their grants and permits TUI device-token issuance. Example: A trusted-proxy TUI requests operator.admin but its device has only operator.sessions.write.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this maintainer-authored PR adds useful behavior beyond the merged client fix, and review found no actionable correctness defect. Priority: P2 Before merge
FindingsNone. Agent review detailsHow this fits togetherThe Gateway WebSocket handshake combines authenticated identity, signed device proof, approved scopes, and connection caps to produce admitted RPC permissions and optional device credentials. flowchart TD
A[CLI or TUI] --> B[Trusted proxy authentication]
B --> C[Signed device verification]
C --> D[Existing pairing grant]
D --> E[Scope intersection and proxy cap]
E --> F[Identity and token policy]
F --> G[Hello response and RPC access]
Technical reviewBest possible solution: Retain the focused opt-in implementation in the existing pairing and token owners with default behavior and publication isolation preserved. Do we have a high-confidence way to reproduce the issue? Current-main pairing admission still routes an over-requesting paired terminal through scope-upgrade handling; the option-off regression exercises that path without executing target code during this review. Is this the best way to solve the issue? The change addresses the remaining first-connection refusal using existing scope intersection, pairing authority, proxy caps, and credential policy without introducing another state owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 423ae0907203. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +90, Tests +77, Docs +62, Generated 0. Total +229 across 18 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (16 earlier review cycles; latest 8 shown)
Reviewed November 21, 2026, 10:06 AM ET / 15:06 UTC (Revision 17). |
0f26434 to
4cce580
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
4cce580 to
30c1228
Compare
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
/allow-security-sensitive-change |
Resolve conflicts from openclaw#199698 and openclaw#202616 landing on main: keep this branch's trustedProxy.narrowToDeviceGrant docs and, in the session-only Access guest test, keep main's hardened close/waitFor structure with this branch's sessions.list admission check.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Resolve the generated config-baseline conflict by regenerating docs/.generated/config-baseline.* with scripts/generate-config-doc-baseline.ts --write, so the hashes cover both this branch's narrowToDeviceGrant key and main's newer plugin keys.
|
Thanks! I merged main to pick up #199698 and #202616; the conflicts were docs wording and one test, no behavior change, and the focused suites (grant narrowing, device-token revocation, audit) pass on the merged head. That moved the head to |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Resolve the generated config-baseline conflict by regenerating docs/.generated/config-baseline.* with scripts/generate-config-doc-baseline.ts --write. The zod-schema.gateway.ts auto-merge combines main's templates comment change with this branch's narrowToDeviceGrant option.
|
Thanks! I merged main to pick up #199698 and #202616; the conflicts were docs wording and one test, no behavior change, and the focused suites (grant narrowing, device-token revocation, audit) pass on the merged head. That moved the head to |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
/allow-security-sensitive-change |
|
@clawsweeper re-review |
|
ClawSweeper could not start a re-review for this item. |
Related to #199692. Stacked on #199698.
What problem this solves
A CLI or TUI guest approved only for session access can ask for broader operator scopes on its first connection. That files a scope-upgrade request for access the administrator already chose to withhold.
How it works
Set
gateway.auth.trustedProxy.narrowToDeviceGrantto let a paired CLI or TUI connect with the intersection of the requested scopes and its approved grant. The Gateway checks the trusted-proxy identity, paired device key, and effective operator role. The connection must have no browserOrigin. The hello response reports the admitted scopes, so the client can use its session permissions on the first connection. A request for broader scopes with no overlap still follows the scope-upgrade flow. An administrator can use this option with manual enrollment or configure enrollment separately throughtrustedProxy.deviceAutoApprove.The option defaults to
falseand applies only to devices with a current grant. Device enrollment and browser connections follow their existing policies. The TUI can store a device token under this opt-in. Human operators governed by named-role policy still receive no device token. Reserved Session Share grants use the dedicated publication-transport admission path.Device tokens can authenticate a direct connection until revoked.
openclaw security auditreportsgateway.trusted_proxy_narrow_to_device_grantwhen this option is on. Keep the trusted proxy as the only Gateway ingress and remove a guest device when access ends. The core configuration baseline gains one boolean key, from 2,666 to 2,667. The trusted-proxy guide documents the option and its token behavior.Evidence
53fe7a0b11bd, an approved session-only guest's broad TUI request files a scope-upgrade request. On013f2b4e0e8fwith the opt-in enabled, the TUI receives only its paired session scope and a device token, with no pending upgrade. A CLI requestingoperator.readreceivesoperator.sessions.readwhen its grant covers session access. The option-off test on the PR head still files the upgrade. These cases run against the Gateway WebSocket server. The main run uses the option-off case from the PR test suite. Exact base-to-head diff013f2b4e0e8f. 275 focused tests passed on macOS arm64. Separate suites covered the opt-in Cloudflare Access JWT verifier, trusted-proxy grant narrowing, Session Share publication request admission, CLI and TUI scope selection, config, and audit behavior. Core typecheck and all 12 baseline ratchets passed.a5b50ef7ff73upgrades two paired guests and their Gateway from the published2026.11.6package. It preserves the settings, credentials, and grants. One guest reuses its stable-issued token. The other receives a token on the first connection and reuses it on restart. Both can run/sessionson the admitted WebSocket after identity resolution. The Access and GitHub responses came from test fixtures. Upgrade evidence