Skip to content

feat: support principal-bound remote Control UI for trusted plugins - #170540

Merged
steipete merged 4 commits into
mainfrom
steipete/remote-control-ui-ingress-core
Oct 13, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/remote-control-ui-ingress-core

Conversation

@steipete

@steipete steipete commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Trusted plugins need to host a remote Control UI and invoke Gateway RPC for an explicitly approved owner or person without sharing the Gateway token or password.

User Impact

A trusted plugin can bind remote UI and RPC to the same principal and chosen access ceiling. Effective access is that ceiling intersected with the principal's current role and session visibility. Embedded browsers receive no reusable device credential, remain pinned to the serving Gateway, and can use an embedder-provided Gateway switcher.

This is a privileged capability for bundled or verified official plugins. A relay can read and modify content in transit and exercise the approved capabilities; this is not end-to-end encryption against the relay. The core capability alone does not publish a Gateway or enable a relay. Existing installations retain their normal direct-listener authentication and need no config migration.

Why This Change Was Made

The Gateway owns principal resolution, live authority, session policy, HTTP route admission, device pairing, and transport shutdown. The service-bound ingress factory composes those existing owners for plugin transports and grant-bound RPC. Revocation and role changes fence retained work as well as new requests; signed embedded browsers authenticate through the live grant and never receive bearer device tokens.

The MCP relay consumer, consent UI, plugin registration, and real-plugin integration case remain in #168233. This PR contains only the reusable core/SDK capability, its core tests and docs, and the embedder transport UI. The merge preserves main's Solid app root, deferred HTTP runtime admission, and exact media-file identity checks.

Evidence

Standalone core validation (the relay package is physically absent):

  • pnpm build:ci-artifacts passed in 228.4s, including SDK declarations, plugin exports, and Control UI build/performance limits.
  • 125 cases passed across the core ingress, transport, HTTP auth, device pairing, dispatch lifetime/authority, and service capability suites. The split initially removed a context still used by the WebSocket test host; that fixture binding was restored and all six core integration cases plus the 13 approval/service cases passed in the focused 70.36s rerun. No production guard or test assertion was weakened.
  • 66 UI cases passed across seven files in 22.79s; 45 desktop/browser cases passed across five files in 41.93s. The merged GitHub grant/media suites also passed all 14 cases (34.72s); their production inputs are unchanged by the split.
  • Docs links (15,332 checked, zero broken), MDX, glossary, config baseline, plugin inventory, SDK exports/surface, and formatting passed. Core production and UI typechecks, plus all 28 affected core test graphs, passed. The current focused lint recheck reports 28 inherited max-lines findings outside this diff; all implicated source and lint configuration blobs match the merged main base. Two earlier findings have disappeared. No lint suppression was added.
  • Managed Codex review of the integrated candidate and final standalone core completed through P2 without remaining actionable findings.

pnpm deadcode:full reports one inherited unused export, renderBoardWidgetError in ui/src/components/board/board-widget-cell-render.ts. The same command reproduces it on clean merged main 3f168ed8c3035b9a5c2490b0c837c0cdcaeeba1e with an independent frozen install; the relevant source and Knip configuration match. Main subsequently removes the obsolete adapter in #170609. The prior SQLite findings are gone. No suppression was added. Required CI remains authoritative, with any inherited-only exception handled through the native evidence workflow. Earlier live ChatGPT/production-relay smoke is recorded in the consumer PR; it covered the earlier owner flow. Current owner/person authorization and revocation are covered by isolated Gateway boundary tests. Live OAuth expiry enforcement is outside this core change and was not independently exercised. The coordinator Gateway was neither restarted nor reconfigured.

Release-note context: trusted plugins can expose principal-bound, tokenless remote Control UI and Gateway RPC, constrained by an approved scope ceiling and the principal's live role; embedded browsers support an embedder-owned Gateway switcher.

Existing end-to-end consumer visuals

These sanitized synthetic before/after captures belong to the MCP relay consumer in #168233. This core PR supplies its ingress capability; the Connected apps panel itself remains in that follow-up.

Before:

Before: consumer plugin panel unavailable

After:

After: consumer principal-bound consent

Follow-up CI fixture validation: test WebSocket hosts use the existing pre-auth payload limit; node-only visibility fixtures preserve the document contract used by browser-client initialization; HTTP-route tests assert abort propagation through composed authority signals; the selected-session mock has its storage-isolation rationale and its obsolete baseline exception was removed by the generator. These changes preserve production behavior. All 69 cases in the five focused authorization, route, activity, and refresh files pass (564.57s total wrapper wall time, dominated by cold worker compilation; UI shard 9.90s). The two payload suites also pass all 45 cases. Fresh independent review through P2, targeted type-aware lint, formatting, and diff checks pass. Broad CI is attached to the repaired head; remaining failures require exact-head attribution before landing.

Archive fixture repair: the selected-session case previously published an archived sessions.describe response before the Archive click. A naturally occurring descriptor refresh could therefore turn that click into an unarchive request. The fixture now publishes that response only after the successful archive mutation, with the committed row timestamp; the original selection, title, transcript, archive attribution, and restored-composer assertions remain unchanged. No production behavior changed. The full archive file passes all 10 cases (150.43s; selected case 3.905s), and targeted type-aware lint, formatting, and both size ratchets pass. A held real descriptor response also passes the original flow when resolved from current fixture state.

The earlier controlled diagnostic reproduced the CI signature once, but its unchanged full-PR countercheck passed, so the bisect did not isolate a causal production hunk. The repair addresses the directly observed invalid fixture chronology; passing replays are not being used as inherited-failure evidence. Fresh independent review through P2 is scoped-clean. The repair and reviewed main merge are published at b060084c99b283f3e69a1b9bd6b4ff5467751348; CI on that exact head remains required. Main independently repaired the premature descriptor and roster clocks; the conflict resolution preserves their deferred patch and clocks while keeping the current post-success descriptor. The affected archive case passes on the merged source (6.031s; 107.83s total, nine unrelated cases omitted), as do UI types, target lint, formatting, and fresh conflict review through P2. The earlier cron snapshot failure matched scheduled main run 38339144048, job 115106094544; any remaining failure on the new head still requires exact-run attribution before landing.

Current CI: run 38345779430 tested merge f7f0a6b351524e6792ccec42d69a382a0fd7aaf4 onto main 5ac63514950809ba05512c161264ec0bc0945639. All nine archive/UI shards pass. The config-preflight missing-export type error and updater readiness-message mismatch both reproduce on that exact main base, with matching test and owner source inputs. The final Node shard reached its one-hour deadline after the Telegram slow-album test timed out and later same-file tests/hooks failed. Linux baseline run 38353820867 verifies the exact main tree and reproduces the same slow-album timeout (120,036 ms; one failed, one passed, 18 skipped), with an unprepared-runtime-config error. The Telegram, ingress, runtime-config, and test inputs are unchanged in the PR merge. Scheduled main does not select this generic E2E file, so the independent baseline supplies attribution. The cancelled remainder remains unrun coverage, and the full later hook cascade was not replayed. CI remains failed; all remaining roots are inherited and are being submitted through the authorized native exception, preserving security and review gates.

@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 13, 2026 02:40
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: b060084c99b283f3e69a1b9bd6b4ff5467751348
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/sandbox-host.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/gateway/auth-policy.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/auth.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/control-ui-plugin-auth-cookie.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/desktop/rfb-preauth.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/device-revocation.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/http-auth-plugin-cookie.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/http-auth-user-profile.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/http-auth-utils.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/http-request-authority.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/mcp-app-sandbox-http.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/gateway/operator-run-authority.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/origin-check.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-http.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server-methods/github-personal-authorization.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/authenticated-request-dispatch.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/connect-admission.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/connect-auth.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/connect-device-pairing.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/connect-existing-device.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/connect-hello.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/connect-pairing-approval-plan.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/connect-session.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/connect-user-profile.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/gateway/server/ws-connection/message-handler-types.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • 6 additional sensitive files; see the workflow summary.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime security Security documentation scripts Repository scripts docker Docker and sandbox tooling agents Agent runtime and tooling extensions: browser size: XL labels Oct 13, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 13, 2026
@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR lets trusted plugin services provide remote Control UI and Gateway RPC access bound to an approved principal and scope ceiling.

Example: A verified person with operator.read approves a grant requesting operator.admin.

  • Before: Plugins have no supported service-owned capability for delegating that person's remote UI and RPC access.
  • After: The binding grants only operator.read and authenticates the embedded browser without issuing a reusable device token.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The approved design has substantial boundary coverage, but the retained-person authority scenario is unproven and the public authentication guidance is incorrect.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Trusted plugins need remote UI and RPC access for an approved owner or person without sharing the Gateway's credentials.
Reason: The maintainer author has approved the direction, and the feature provides a reusable delegation boundary without adding a relay deployment or model-facing core tool.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep this maintainer-owned, security-sensitive feature open; the prior tokenless reconnect documentation finding remains unresolved.

Priority: P2
Reviewed head: c43cd1b70ede31774978ce7e1883224f1063eb65

Before merge

  • Add real behavior proof - Authority-chain proof required: the production-composition evidence covers signed tokenless admission, cross-person media denial, and held owner writes rejected after grant revocation, but person role reduction is tested only before a new request. Supply an allowed person write and the same admitted write held across an admin-to-reader reduction, showing rejection before mutation and unchanged persisted state through the real owner; an authorized production-path harness is sufficient. Redact credentials, IPs, and non-public endpoints. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Describe tokenless reconnects consistently in the public guides (P2) - The added guidance says ingress browsers receive a device token that also works on the direct listener, but connect-device-pairing.ts explicitly returns deviceToken:null for every remote ingress principal and GatewayBrowserClient ignores stored tokens in ingress mode. The added paragraph in https://docs.openclaw.ai/web/control-ui also says the browser saves and retries that token. Operators following these guides receive the wrong reconnect and revocation model. Update both guides to describe signed, credential-free reconnects under the live grant, consistent with the new SDK guide. This prior finding remains unfixed.
  • Resolve security review attention item - The new delegation boundary depends on live grant and principal authority remaining valid at final effects.
  • Complete next step - Establish whether the archive E2E failure is caused by this PR; fix the responsible hunk if established, or document matching base-failure evidence without weakening the assertion.

Findings

  • [P2] Describe tokenless reconnects consistently in the public guides — docs/gateway/security/network-exposure.md:174-178

Tests

  • Missing end-to-end proof: The supplied evidence does not exercise an admitted person write held across role reduction through the production mutation owner and verify unchanged persisted state.
Agent review details

How this fits together

The Gateway admits plugin-forwarded HTTP, WebSocket, and RPC requests, intersects the grant ceiling with current principal authority, and dispatches through existing resource and method owners.

flowchart LR
  A[Trusted plugin service] --> B[Principal binding]
  B --> C[Live grant and role authority]
  B --> D[Remote HTTP and WebSocket transport]
  B --> E[Gateway RPC dispatch]
  D --> F[Existing resource and method owners]
  E --> F
Loading

Technical review

Best possible solution:

Retain the shared Gateway-owned ingress capability, correct the tokenless public guidance, and demonstrate retained-person authorization at the final write boundary.

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

The documentation contradiction is directly reproducible by comparing the public guides with token issuance and browser credential selection; no target code or tests were run.

Is this the best way to solve the issue?

A service-bound SDK capability fits the ownership boundary because principal resolution, session visibility, authentication, and retained-effect checks remain with existing Gateway owners.

Full review comments:

  • [P2] Describe tokenless reconnects consistently in the public guides — docs/gateway/security/network-exposure.md:174-178
    The added guidance says ingress browsers receive a device token that also works on the direct listener, but connect-device-pairing.ts explicitly returns deviceToken:null for every remote ingress principal and GatewayBrowserClient ignores stored tokens in ingress mode. The added paragraph in https://docs.openclaw.ai/web/control-ui also says the browser saves and retries that token. Operators following these guides receive the wrong reconnect and revocation model. Update both guides to describe signed, credential-free reconnects under the live grant, consistent with the new SDK guide. This prior finding remains unfixed.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 33a438a7624d.

Provenance checked

Testing

Proof path: in-process harness.

Security

Needs attention: The new delegation boundary depends on live grant and principal authority remaining valid at final effects.

Evidence

What I checked:

  • Approved product direction and keep-open guards: The maintainer-authored PR introduces a privileged capability for bundled or verified official plugin services, explicitly accepts relay visibility into content, and carries the protected security label. (c43cd1b70ede)
  • Capability remains absent from current main: Current main lacks the controlUiIngress service-context property and gateway-ingress package export introduced here. (src/plugins/plugin-registration.types.ts, 33a438a7624d)
  • Tokenless implementation contradicts public guidance: Ingress pairing returns no device token, while the network-exposure guide says a reusable direct-listener token is issued; the Control UI guide also describes storing and retrying that token. (src/gateway/server/ws-connection/connect-device-pairing.ts:592, c43cd1b70ede)
  • Authority coverage distinguishes admission from retained effects: Person role reduction is followed by a new rejected request; the held-write scenario instead uses the shared owner and grant revocation. (src/gateway/remote-control-ui-ingress.integration.test.ts:699, c43cd1b70ede)
  • Supplied media inspected: The prepared images show the consumer's unavailable/Connected apps panels and historical sidebar identity presentation; none shows retained person authorization across role reduction. (c43cd1b70ede)
  • Existing storage accepts additive provenance: The new remote-ingress approval kind uses the existing approved_via TEXT column; existing approval values remain accepted and no schema or existing-row rewrite is introduced. (src/infra/device-pairing-row-mapping.ts:26, c43cd1b70ede)

PR surface

PR surface statistics unavailable: the file list is incomplete.

Labels

Label changes:

  • remove proof: 📸 screenshot: Current real behavior proof evidence kind is none.

Label justifications:

  • P2: This is an approved optional capability with a focused documentation defect, rather than an established urgent runtime regression.
  • merge-risk: 🚨 compatibility: The PR adds a public Plugin SDK subpath and service-context capability; its direction is already approved by the maintainer author.
  • merge-risk: 🚨 security-boundary: Trusted plugins gain delegated principal authority across HTTP, WebSocket, and RPC boundaries; relay access to approved capabilities is explicitly accepted.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add final-effect evidence that reducing a person's role rejects an already admitted write and leaves persisted state unchanged.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-13T02:53:57.628Z sha 7813d32 :: needs real behavior proof before merge. :: [P2] Update Node document fixtures for the new client ingress check | [P2] Update the route test to verify composed cancellation signals | [P2] Describe tokenless reconnects consistently in the public guides
  • reviewed 2026-10-13T03:21:15.154Z sha c43cd1b :: needs real behavior proof before merge. :: [P2] Describe tokenless reconnects consistently in the public guides

Reviewed October 13, 2026, 12:02 AM ET / 04:02 UTC (Revision 3).

@clawsweeper clawsweeper Bot removed the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Oct 13, 2026
@steipete
steipete merged commit 2444aae into main Oct 13, 2026
275 of 281 checks passed
@steipete
steipete deleted the steipete/remote-control-ui-ingress-core branch October 13, 2026 06:13
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 14, 2026
…penclaw#170540)

* feat: add principal-bound remote Control UI ingress

* test: align remote ingress fixtures with runtime contracts

* test: publish archive fixture state after the mutation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: browser gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts security Security documentation security-sensitive-changed size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants