Skip to content

feat(openclaw-id): add the tunnel transport, OpenClaw ID sign-in and relayed-device Gateway auth - #192345

Merged
jalehman merged 23 commits into
mainfrom
openclaw-id/pr-tunnel-signin
Nov 6, 2026
Merged

jalehman merged 23 commits into
mainfrom
openclaw-id/pr-tunnel-signin

Conversation

@jalehman

@jalehman jalehman commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A linked claw must be reachable from an owner's or member's browser through the OpenClaw ID relay, and the Gateway must authenticate those relayed devices by their membership, not by headers or other credentials. This PR adds the tunnel transport, OpenClaw ID sign-in for the Control UI, and the Gateway auth changes that admit relayed devices.

User Impact

No user-visible change while the gateway.openclawId.enabled Labs switch is off (the default): no tunnel child, no ingress listener and no tunnel principal resolver exist, and every auth path behaves as on main.

With the switch on and the services configured, the Gateway runs a supervised tunnel child, the local operator can sign in with OpenClaw ID and link the claw, and admitted devices reach the Gateway through the relay with their owner, operator or viewer role. Automations, condition scripts, shell commands and stream watchers that a relayed device creates keep running across restarts under that device's authority, and stop when the device is removed or its role changes.

Security-relevant: this PR changes Gateway authentication, ingress attribution, the browser-origin check, the plugin cookie handoff and how scheduled work restores its creator's authority. Those changes are listed separately below.

Why This Change Was Made

Builds on #192335 (Gateway membership authority), now merged to main as 428ca7d. It also needs the iroh Node binding, #191470, and its watcher fix, #193995: the tunnel child loads @openclaw/iroh-node at runtime and reports the transport unavailable (and keeps the Gateway running) when it cannot. With #193995, the binding's relay watcher ends when the endpoint closes, so the child exits on its own.

Tunnel transport (src/gateway/openclaw-id/):

  • tunnel-child/**: a separate child process that owns the iroh endpoint. It authenticates each device key W in the QUIC handshake, refuses keys that are not admitted before any stream, and proxies HTTP and WebSocket streams to the Gateway over a private Unix socket with a per-boot proxy token. Client-supplied ingress and identity headers are replaced with authenticated facts.
  • tunnel-supervisor.ts, tunnel-ipc.ts, tunnel-runtime.ts: start, health-ping, RSS-limit, backoff and stop the child (SIGTERM, then SIGKILL); push membership changes to it; report running, unavailable, relay denied or crash looping. The child never forces its exit: it closes its server and endpoint and releases the IPC channel, as the repository's forced-exit guard requires (Hang at shutdown nodejs/node#64274).
  • ingress-listener.ts, tunnel-api.ts: the private listener marks each request as openclaw-id-tunnel with W and a synthetic per-device address, and serves the small tunnel API that owner devices use behind the loader.
  • remote-signout.ts: signs out one relayed browser (closes its connections and revokes its tokens) without removing the device.
  • service.ts: starts the tunnel runtime when the switch is on, publishes the tunnel principal, device-token binding and claw-origin resolvers, and requires the running endpoint key for linking.

OpenClaw ID sign-in (account-sign-in.ts, openclawId.authority account_* actions): an OIDC authorization-code flow with PKCE for the Control UI's account menu, direct loopback only. The Gateway holds the verifier and redeems the code; it keeps only display claims (sub, name, email) in the claw record.

Gateway auth changes (security boundary):

  • auth.ts: a request the tunnel listener attributed to W authenticates as a trusted-proxy principal in every auth mode: owner devices act as the Gateway owner, members carry openclaw-id:<account_id> as the user. A key the authority no longer admits is refused (openclaw_id_not_admitted), and a tunnel request never falls back to the Gateway's other credentials.
  • ingress-attribution.ts: adds the openclaw-id-tunnel transport (never direct loopback, rate-limited per device key). While the switch is on, identity headers (Cloudflare Access, Remote-User, X-Remote-User, the configured userHeader/requiredHeaders) also disqualify loopback locality, so a proxy that omits client-address headers cannot reach the local-only link ceremony. With the switch off this rule does not apply and attribution is unchanged.
  • ws-connection/*, operator-role-policy.ts, http-auth-user-profile.ts: members are capped by their role's operator policy (operator: read, write, approvals, questions, talk; viewer: read only) on WebSocket and HTTP. Pairing within that ceiling is approved automatically for relayed browsers; owner devices pair with what they request.
  • device-token-binding.ts users (connect-auth.ts, connect-device-pairing.ts, http-auth-utils.ts): a device token issued over the tunnel is bound to the W that obtained it; presenting it from another W, or from ordinary ingress, is refused and logged.
  • origin-check.ts: a relayed WebSocket may also use the linked claw's own origin (https://<claw hostname>), read from the current owner-signed binding.
  • http-auth-plugin-cookie.ts, control-ui-plugin-auth-cookie.ts: a signed plugin cookie cannot replace a relayed device's current membership, and none is issued to a tunnel request (it could be replayed on ordinary ingress).
  • gateway-owner-profile.ts, connect-device-pairing.ts: an owner device acts as the Gateway owner when named gateway.roles are configured, like a token or password client.

Docs: docs/gateway/remote.md (OpenClaw ID alongside Tailscale, Cloudflare Access and Gateway credentials) and docs/gateway/trusted-proxy-auth.md (identity headers deny loopback locality).

Review

An independent review (GPT-6 Astra) of this PR found four issues; three are fixed here with tests, one is narrowed:

  • Fixed: plugin read cookies were issued to tunnel requests and could be replayed on ordinary ingress for their five-minute life. Tunnel requests no longer get them.
  • Fixed: owner devices were refused when named gateway.roles were configured, because they carry no user. They now take the owner path.
  • Fixed: the identity-header locality rule applied even with the switch off. It now applies only while OpenClaw ID is on.
  • Fixed (decision in feat(openclaw-id): add Gateway membership authority and publication behind the Labs flag #192335): device tokens issued over the tunnel stay bound to their device key across a Gateway restart with the switch off. feat(openclaw-id): add Gateway membership authority and publication behind the Labs flag #192335 reads the saved bindings at Gateway start; here both ingress checks (connect-auth.ts, http-operator-device-token.ts) await that read. http-auth-utils.paired-device.test.ts saves a binding in the real claw store, starts a fresh service with the switch off, and shows the token refused on HTTP, including for a request that arrives before the read finishes. The test fails without the Gateway-start read.

ClawSweeper's review of 9049570: a removed owner could still invoke tools (P1), fixed here. An HTTP request kept only the role it was admitted with. A POST /tools/invoke waiting in a before-tool-call hook therefore still ran its tool after its device was removed: closing the tunnel connection does not stop a request the Gateway already holds. Every authority check on a relayed HTTP request now also asks the membership authority whether the device is still admitted with the same kind, account and role (isOpenClawIdTunnelPrincipalCurrent, read from the claw record already loaded, in http-auth-user-profile.ts). If the device is removed, its role changes, or OpenClaw ID turns off, the request's next check fails. That includes the last check before the tool runs, which answers 403 "Gateway requester authority changed". http-auth-utils.openclaw-id-tunnel.test.ts drives the real HTTP authorization path and fails without the fix. The same review's P2, four test fixtures missing getGatewayServer, was fixed earlier.

Work that outlives a request keeps the device that authorized it (maintainer decision, 2026-11-05). Rather than refusing these features for tunnel devices, they keep working under the original device's authority. Independent reviews of each step found the gaps fixed below, each with a regression test that fails without the fix:

  • Canonical profile. HTTP and WebSocket members use the Gateway user profile keyed by their verified OpenClaw ID account (feat(openclaw-id): add Gateway membership authority and publication behind the Labs flag #192335), never an email fallback.
  • Live authority on WebSocket and runs. A member removed or downgraded while connected is closed with 4001 at its next request, and its runs stop. An operator member keeps its membership role when gateway.roles names a reader default. An explicit tunnel request is attributed before the ambient Tailscale checks.
  • Scheduled and recovered work. A job, condition script, script payload, shell command or stream watcher created over the tunnel stores the original device's authority with the job: claw, root, the seq at which the device was listed and, for owner devices, the device itself. That authority does not depend on which conversation runs the job. Every run, restart and recovery checks it against the local membership record, and a removal, re-approval, role change or switch-off cancels the work, including a running shell command's process tree. Recovery waits only for the local record to load, not for the relay or Discovery.
  • Stream watchers. The authority for the watcher's process is kept apart from the authority for the work its output triggers. Editing what the output does never changes who authorized the running command. Re-enabling the watcher or changing its command takes a current authorized operator, who becomes the process's authority.
  • Edits by someone else. An admin who changes another person's schedule or enables their job keeps that person's authority on the job: the edit never makes a member's job run as the admin. Changing what another person's job runs needs that person or an ownership transfer. A Control UI continuation is owner-only only while its retained scopes include operator.admin.
  • HTTP execution. OpenAI-compatible runs, /tools/invoke and HTTP session creation carry the admitted device's principal.
  • Gateway stop. A stopped Gateway ends local OpenClaw ID authority, even when the first authority load is still in flight.

The stored source format adds a standalone variant beside the existing parent-bound one; jobs created before this PR load unchanged. An ownership transfer still retires the previous person's authority, as on main.

ClawSweeper's review of e164242 raised the same restart gap (now fixed, see above) and one doc finding, fixed here: docs/gateway/trusted-proxy-auth.md now says the Cloudflare Access, Remote-User, X-Remote-User and configured-header locality rule applies only while OpenClaw ID is on, and the Tailscale rule always applies.

Rebased onto #192335 at 9269511 and main at 06acff14158. service.publication-refresh.test.ts now waits for startup publication, which #192335 moved beside the lifecycle queue.

Rebased with #192335 onto main at 0809cf31e69 (#193146 merged), without conflicts.

Rebased onto main at 49f8a60f227 (after #192859). Two files this PR touches had gone over the 700-line lint cap, so two self-contained pieces moved out, unchanged:

  • verifyHttpOperatorDeviceToken, the HTTP device-token fallback that holds the tunnel-binding check, moved from http-auth-utils.ts to http-operator-device-token.ts.
  • The config-derived settings helpers moved from openclaw-id/service.ts to openclaw-id/service-settings.ts.

Rebased with #192335 onto main at 0afeaad457c. Main's person-ingress recovery (#193098) changed the same recovery owners; its person sources and this PR's device sources are separate kinds in the same recovery codec, and both restore paths run.

Security review and CI on the rebased head (1038de0). A security review and hosted CI found the issues below. Each fix is in its own commit with a regression test, and each test was shown to fail with its fix reverted:

  • Timing edits from another device replaced a job's grant (P1). A timing edit from a sibling device on the same profile, or from the same device after re-approval, could refresh a job's retained grant to the editor's listing. Now only the exact device and listing that created the job refreshes its grant; any other edit keeps the original (cron-operator-source.ts, tunnel-principal.ts).
  • Tokens issued before the binding writer existed (P1). The token-binding writer is published before the tunnel starts. A token issued over the tunnel while the writer is absent, or while saved bindings are unreadable, is refused instead of left unbound (service.ts, device-token-binding.ts).
  • Plugin HTTP routes dropped the device (P2). Gateway-authenticated plugin route clients now carry the tunnel principal, so durable work they create stays tied to the device (server/plugins-http.ts).
  • Tunnel nodes and network-location approval. With default config, a node connecting over the tunnel started an SSH identity probe against its synthetic address. A trusted CIDR covering that address (for example fd00::/8) would have approved it automatically. Tunnel connections now report no client-address source, so neither path considers them, and tunnel nodes need manual pairing (ws-connection/message-handler.ts). The synthetic address is still used for display and rate limiting.
  • Tunnel child shutdown. The child no longer calls process.exit. Without the binding fix fix(iroh-node): end the home relay watcher when the endpoint closes #193995 it stays alive after stopping, because the endpoint's relay watcher never ends.
  • CI fixes: the long-path ingress socket now lives under the OpenClaw temp root; two import cycles are broken (stream-operator-source.ts is now a leaf codec, remote-signout.ts uses a local effects type); the stream scope key export is renamed jobScopeKey; the cron context replay script narrows operator-source variants; a deferred-profile test fixture gets a real auth result; and the SSH-probe test mock keeps the module's real exports.

An independent security review (GPT-6 Astra) of cb9d750, which includes the first four fixes, found no P0–P2 issues. It checked exact OCID identity, durable-source revalidation, control-only edits, peer-bound tokens, tunnel network location, Labs-off behavior, private-ingress authentication and untrusted transport input.

Rebased onto main at 36e52993c9f after #192335 merged. The only conflict was the database-worker list in test/vitest/vitest.gateway-server-paths.mjs: #192335's final head had already sorted its two persistence tests there, so this PR now adds only its own tests, in sorted order. The changed lines are otherwise identical to the previous head.

Rebased onto main at 2394bff0c01, which includes the protocol revocation repair #193990 (merged as c6480f78289). This resolves ClawSweeper's P1 ("Include the protocol revocation repair before exposing tunnel statements") and the related high finding ("Surviving delegated membership grants Gateway owner authority"): the tunnel statements route now calls the repaired authority. The rebase had no conflicts. 21 of the 22 commits are unchanged; the first differs only in context lines, because main's #193924 made two types in device-token-binding.ts and member-profiles.ts module-private. One new commit makes inactivityWindows private to owner-lifecycle.ts: this PR moved its last outside caller there, so main's unused-export scan flagged it.

The live Gateway trace from #193990 (comment) ran again on this head (c546781), on a macOS arm64 host through Crabbox, and matched its "This PR + #193990" column step for step:

  • A delegated device that re-certifies itself keeps approved_by on its approver.
  • Adding its peer key to another device is refused with 403 target_mismatch.
  • Replaying an older certificate after a capability reduction is refused with 403 wrong_signer.
  • Revoking the approver removes 2 devices. The delegated device's WebSocket is closed with 1008, its peer key leaves the tunnel child's membership, its reconnects (with and without its old device token) are refused, and the token store reports token-revoked.
  • Legitimate approval, enrollment and recovery still work.

Remaining proof (maintainer decision, 2026-11-06). This PR lands with the trace above as its real-Gateway proof. ClawSweeper also asked for real-Gateway traces of four more scenarios. These are covered by tests, not traces:

  • A held HTTP tool request after removal. http-auth-utils.openclaw-id-tunnel.test.ts drives the real HTTP authorization path: an admitted request loses authority when its device is removed, its role changes or OpenClaw ID turns off.
  • Saved-token replay after a restart with the switch off. http-auth-utils.paired-device.test.ts saves a binding in the real claw store and keeps the token refused on HTTP after a Gateway start with the switch off.
  • Restored jobs and streams after removal, re-approval or role change. scheduled-source.persistence.test.ts recovers serialized device sources and covers sibling and re-approved editors. cron-command-source.test.ts runs real shell commands and cancels one whose device is removed mid-run.
  • Upgrade from a stable release. The stored source format only adds a variant beside the existing parent-bound one, which is unchanged. No upgrade from a stable release was run.

The residual risk is behavior that appears only in a running Gateway, or only after an upgrade from a stable release, that these tests do not exercise.

Evidence

  • On 58e3c05 (this PR rebased onto 2394bff0c01), on a macOS arm64 host through Crabbox with fix(iroh-node): end the home relay watcher when the endpoint closes #193995's binding: the PR's changed test files, src/gateway/openclaw-id and the related cron and plugin-route suites (4 Vitest shards), the protocol package (25 files), pnpm tsgo:core, tsgo:core:test, root-script types, the chained-assertion lint, oxlint on the 159 changed code files, pnpm format:check, and the temp-path, import-cycle, Madge, export-name and mock-export guards all pass. On c546781, which only makes one function private, the unused-export scan, pnpm tsgo:core and the owner-lifecycle tests pass. The env-var count (461 of 461) and the test-line ratchet pass against the new base.
  • On 305b6cd (after the rebase), on a macOS arm64 host through Crabbox: pnpm install --frozen-lockfile, pnpm tsgo:core, pnpm tsgo:core:test, oxlint on the 181 changed files, and pnpm test over the 40 test files this PR adds or changes, src/gateway/openclaw-id and test/vitest-cli-ownership.test.ts all passed.
  • On 609efde7166: the OpenClaw ID, auth, operator-run, cron-stream, cron-source, HTTP execution, session-sharing and cron-method Gateway suites, 90 files, 1,098 tests passed; the cron suites (operator sources, condition scripts, execution context, store, command runner, stream schedules, isolated runs), 77 files, 726 tests passed, 1 skipped. Both include the tests added by fix(agents): preserve bounded operator authority across restart continuations #193098. cron-command-source.test.ts runs real shell commands: a command whose device is removed mid-run is cancelled, and later runs are refused.
  • With the iroh binding from feat(openclaw-id): add iroh Node binding crate #191470 present (built from its head a66ec81), the tunnel child and supervisor suites pass end to end: 5 files, 28 tests, including admission refusal before any stream, HTTP and WebSocket proxying, header replacement, the 64-stream limit, malformed HEAD reset and closing a live connection when membership drops its key. Without the binding the tunnel-child tests skip, as they do in CI, which does not build the binding.
  • On e8b2ef9, with the darwin-arm64 binding built by fix(iroh-node): end the home relay watcher when the endpoint closes #193995's CI (run 42174068153), on a macOS arm64 host through Crabbox: the tunnel child and supervisor suites pass, including the child exiting 0 by itself after an IPC disconnect and after SIGTERM. With feat(openclaw-id): add iroh Node binding crate #191470's binding, those two tests time out because the child stays alive. The forced-exit boundary lint, oxlint, oxfmt and pnpm tsgo:core also pass.
  • For the fixes since 1038de0, on the same host: the PR's changed test files and the OpenClaw ID suites pass. Six revert-the-fix checks each fail on the expected assertion (sibling timing edit, writer order, unreadable bindings, plugin-route principal, tunnel node auto-approval, child exit). pnpm tsgo:core, tsgo:core:test, root-script types, changed-file oxlint, formatting, mock exports, the temp-path, import-cycle, Madge and export-name guards, and the test-line ratchet all pass.
  • Labs switch off: the PR 1 off-state tests still pass here, and coexistence.test.ts shows Access, Serve and tailnet users are admitted with their existing permissions but get no People, link ceremony or sign-in.
  • pnpm tsgo:core, all src test typecheck shards, changed-file lint, pnpm config:docs:check and pnpm build pass on this head.
  • Test-line ratchet: config/test-lines-allocations/openclaw-id-tunnel-signin.txt allocates 5,167 of the test lines this PR adds, and the base-aware ratchet passes on this head. Existing tests change only where this PR changes their contract: two publication-refresh tests restart with a new service, because stop() is now final as it is for the Gateway, and an unrestored operator-source run reports basis operator-source.
  • Staging: the lab Gateways run this code before the durable-source work (openclaw 1bc84010c2e). The gates recorded in feat(openclaw-id): add protocol contracts package #191469 went through this tunnel: removed browsers reconnecting through the relay were refused at connection setup with no HTTP or WebSocket line logged; the removed owner device's open Control UI session was closed with 1008 removed from this claw, and its operator tokens were revoked.

@clawsweeper

clawsweeper Bot commented Nov 3, 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.

@jalehman

jalehman commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Local pnpm check:changed --base HEAD~1 on e164242c350 (stacked on #192335): every check passed except the Knip dead-export scan. It reports only ui/src/pages/systems/systems-sidebar.tsx: systemKind, which is inherited from main (this PR doesn't touch the file). The three OpenClaw ID exports Knip also reported in an earlier run are no longer exported in this head.

@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Nov 3, 2026
@jalehman

jalehman commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR adds OpenClaw ID tunnel transport, local account sign-in, and membership-bound Gateway authentication and scheduled execution.

Example: An admitted viewer connects through the OpenClaw ID tunnel to a token-authenticated Gateway.

  • Before: Current main has membership authority but no working tunnel entrance.
  • After: The viewer can read through the tunnel without the Gateway token, while chat and administrative operations remain denied.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful, owner-directed implementation with the previous blocker repaired; partial Gateway evidence does not yet establish every retained-authority or upgrade boundary.
Proof confidence 🦐 gold shrimp (3/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: Owners and members cannot reach a linked Gateway through the OpenClaw ID relay using their admitted browser devices.
Reason: Maintainer direction approves the capability and durable-device authority model, while existing access methods and the default-disabled Labs boundary remain available.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this maintainer-authored feature open. The previous protocol revocation finding is resolved, and no additional concrete correctness defect was established.

Priority: P2
Reviewed head: c546781a4b318e823d0786e1402c6e3990ba56a1

Before merge

  • Add real behavior proof - Authority-chain proof required: the current-head Gateway trace establishes legitimate enrollment, private-ingress rejection, delegated-device teardown, and refused reconnects and token reuse. It does not show refusal before a held HTTP tool effect, ordinary-ingress token replay after a Labs-disabled restart, or cold-restored jobs and streams after removal, reapproval, or role change. Those paths have supporting tests, and the maintainer explicitly accepted the recorded trace limitation, but that does not waive this review's final-effect gate. Supply redacted production-path output with allowed controls and forbidden effects absent; redact IPs, API keys, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security review attention item - No additional concrete exploit was established, but required final-effect authority evidence remains incomplete.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Low-value test src/gateway/openclaw-id/tunnel-principal.test.ts: Remove the 'caps members by role and leaves owners uncapped' helper test: it asserts static policy values already exercised through owner, operator, and viewer Gateway authorization scenarios.
  • Missing end-to-end proof: Supply production-path allowed/refused final-effect evidence for held HTTP execution, disabled-restart token replay, and cold-restored jobs and streams; stable-to-head preservation is also unshown.
Agent review details

How this fits together

The tunnel authenticates device keys and forwards HTTP and WebSocket traffic through private ingress; Gateway membership and execution owners determine permissions and revalidate retained device grants.

flowchart LR
  Browser[Admitted browser device] --> Tunnel[QUIC tunnel child]
  Tunnel --> Ingress[Private Gateway ingress]
  Ingress --> Auth[Gateway authentication]
  Auth --> Membership[Membership authority]
  Auth --> Execution[HTTP and WebSocket execution]
  Execution --> Scheduled[Scheduled work and recovery]
  Scheduled --> Membership
Loading

Technical review

Best possible solution:

Retain the existing membership and execution owners, with device-bound grants verified through their final effects and existing persisted state preserved.

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

This is a new capability: current main provides membership authority but lacks the tunnel entrance that this PR supplies.

Is this the best way to solve the issue?

The design reuses the membership, authentication, admission, and recovery owners; separating transport custody from membership decisions and retaining process grants independently of mutable payloads serves distinct lifecycle requirements.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8dd41fc95291.

Provenance checked

Testing

Proof path: in-process harness.

Security

Needs attention: No additional concrete exploit was established, but required final-effect authority evidence remains incomplete.

Evidence

What I checked:

PR surface

PR surface statistics unavailable: the file list is incomplete.

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: This is an optional Labs feature with meaningful remote-access value and no established urgent regression.
  • merge-risk: 🚨 security-boundary: The PR makes authenticated tunnel devices Gateway principals and persists their authority for later execution; ordinary CI cannot establish all final-effect revocation guarantees.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp 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 proof for removed or reassigned devices on held HTTP requests and restored jobs and streams, including saved-token replay after a Labs-disabled restart.
  • Demonstrate a latest-stable-to-head upgrade preserving existing jobs, settings, and stored authority.

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 (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-11-03T23:00:51.461Z sha e164242 :: needs real behavior proof before merge. :: [P1] Preserve tunnel-token restrictions across disabled restarts | [P3] Qualify the identity-header rule with its Labs condition
  • reviewed 2026-11-04T09:11:09.990Z sha 530a604759f913e0403097e90395d738852dc2eb :: needs real behavior proof before merge. :: [P1] Preserve tunnel-token restrictions across disabled restarts
  • reviewed 2026-11-05T00:30:25.668Z sha 90495705a31348baa9673641873d28a50115951b :: needs real behavior proof before merge. :: [P1] Retain live tunnel membership in HTTP authority checks | [P2] Migrate all service fixtures to the required Gateway getter
  • reviewed 2026-11-05T04:42:24.652Z sha 47a5166 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-05T22:32:47.882Z sha 609efde :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-06T01:05:03.355Z sha c434aed :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-06T06:47:43.156Z sha e8b2ef9 :: needs real behavior proof before merge. :: [P1] Include the protocol revocation repair before exposing tunnel statements
  • reviewed 2026-11-06T06:58:10.063Z sha bc27bd1 :: needs real behavior proof before merge. :: [P1] Include the protocol revocation repair before exposing tunnel statements

Reviewed November 6, 2026, 9:14 AM ET / 14:14 UTC (Revision 10).

@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Nov 3, 2026
@clawsweeper clawsweeper Bot removed the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Nov 3, 2026
@jalehman
jalehman force-pushed the openclaw-id/pr-gateway-core branch from 1eb1706 to e9522d1 Compare November 4, 2026 08:41
@jalehman
jalehman force-pushed the openclaw-id/pr-tunnel-signin branch from e164242 to 530a604 Compare November 4, 2026 09:02
@jalehman

jalehman commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 4, 2026
@jalehman
jalehman force-pushed the openclaw-id/pr-gateway-core branch from 9269511 to f6264ac Compare November 4, 2026 09:13
@jalehman
jalehman force-pushed the openclaw-id/pr-tunnel-signin branch 2 times, most recently from 7c7e47b to 548e343 Compare November 4, 2026 23:53
@jalehman
jalehman force-pushed the openclaw-id/pr-gateway-core branch from f6264ac to 5c6b8e6 Compare November 4, 2026 23:53
@jalehman
jalehman force-pushed the openclaw-id/pr-tunnel-signin branch from 548e343 to 9049570 Compare November 5, 2026 00:21
@jalehman

jalehman commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@jalehman
jalehman force-pushed the openclaw-id/pr-tunnel-signin branch from 4f86c57 to c546781 Compare November 6, 2026 14:04
@jalehman

jalehman commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Nov 6, 2026
@jalehman
jalehman merged commit 59b8a11 into main Nov 6, 2026
204 checks passed
@jalehman
jalehman deleted the openclaw-id/pr-tunnel-signin branch November 6, 2026 14:30
@jalehman

jalehman commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 7, 2026
…relayed-device Gateway auth (openclaw#192345)

* feat(openclaw-id): add the tunnel transport, OpenClaw ID sign-in and relayed-device Gateway auth

* fix(openclaw-id): an HTTP request from a removed tunnel device does nothing more

A relayed HTTP request kept the role it was admitted with, so a POST
/tools/invoke waiting in a before-tool-call hook still ran its tool after the
device was removed. Every authority check on a relayed HTTP request now asks
the membership authority whether the device is still admitted with the same
kind, account and role; a removal, a role change or OpenClaw ID turning off
fails the next check, including the last one before the tool runs.

* fix(openclaw-id): keep durable work bound to the device that authorized it

Scheduled jobs, condition scripts, script payloads, shell commands, stream
watchers and HTTP execution created over the tunnel now keep the original
device's authority (claw, root, listing seq, owner device) with the job.
Every run, restart and recovery rechecks it against the local membership
record and cancels the work when the device is removed, re-approved, its role
changes or the switch turns off. Recovery waits only for the local record.

- WebSocket and run authority follow current membership; HTTP and WebSocket
  members use the canonical OpenClaw ID profile.
- Stream watchers keep the process grant apart from the payload grant.
- Another operator's timing edits keep the original requester; they never
  promote a member's job to the editor.
- Restored Control UI continuations are owner-only only under admin scope.
- A stopped Gateway ends local authority even during a cold first load.

* test(openclaw-id): bound the ingress test WebSocket server payload

* fix(openclaw-id): keep a device's scheduled grant when another device edits its timing

* fix(openclaw-id): publish the token-binding writer before the tunnel admits devices

* fix(gateway): keep the tunnel principal on plugin HTTP route clients

* fix(gateway): never auto-approve a tunnel node by its synthetic address

* test(openclaw-id): check the tunnel child exits on its own

* fix(openclaw-id): keep the long-path ingress socket under the OpenClaw temp root

* refactor(cron): break the stream operator source import cycle

* refactor(openclaw-id): break the sign-out type cycle with the service

* refactor(gateway): give the stream job scope key its own export name

* fix(scripts): narrow operator source variants in the cron context replay

* chore(test): allocate the OpenClaw ID tunnel regression test lines

* test(gateway): give the deferred profile fixture a real auth result

* test(gateway): keep real SSH verify exports in the tunnel node mock

* fix(openclaw-id): let the tunnel child exit without forcing it

The child now records its exit status, closes the ingress server and iroh
endpoint, and releases the IPC channel so Node exits on its own, as the
no-forced-process-exit guard requires (nodejs/node#64274). It relies on the
iroh binding ending HomeRelayWatcher.next() when the endpoint closes (openclaw#193995).

* fix(openclaw-id): require the iroh relay watcher so the tunnel child can exit

A binding without HomeRelayWatcher made the child fall back to endpoint.online(),
which iroh leaves pending after the endpoint closes. That pending native call kept
a stopped child alive, so after the Gateway died it could hold its endpoint key
indefinitely. The loader now refuses such a binding as unavailable.

* fix(openclaw-id): zero the endpoint key when binding the endpoint fails

* test(openclaw-id): mock node:module without spreading its class export

* chore(test): allocate the OpenClaw ID tunnel test lines CI measures

* fix(openclaw-id): keep the inactivity window helper private to the owner lifecycle

service.ts no longer imports inactivityWindows after the owner-expiry timer moved into owner-lifecycle.ts, so the export had no consumer and failed the unused-export scan.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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.

3 participants