Repository navigation
feat(gateway): auto-approve node pairing via SSH device-key verification - #104180
Conversation
f58fc55 to
e496e1c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f58fc55264
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| | "owner" | ||
| | "silent" | ||
| | "trusted-cidr" | ||
| | "ssh-verified" |
There was a problem hiding this comment.
Include ssh-verified approvals in node inventory UI
Adding this new persisted approvedVia value also needs the Nodes UI contract/classifier updated: device.pair.list returns paired records with approvedVia, but ui/src/lib/nodes/index.ts:59 still excludes "ssh-verified" and ui/src/lib/nodes/inventory.ts:157 only treats silent/trusted-cidr as autoApproved. SSH-verified nodes therefore lose the auto-paired chip and are omitted from the stale auto-approved duplicate cleanup even though this change makes them auto-approved on reconnect.
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 11, 2026, 1:09 AM ET / 05:09 UTC. Summary PR surface: Source +788, Tests +480, Docs +86. Total +1354 across 30 files. Reproducibility: yes. at source level. Current main preserves manual pairing unless CIDR approval is explicitly configured, while the branch enables SSH verification when the new key is absent; Review metrics: 2 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Preserve manual pairing when the setting is absent, bind the SSH client's effective destination to the observed peer address while retaining only intentionally supported key and proxy configuration, add redirect regression coverage, and demonstrate real matched and mismatched gateway-to-node runs before merge. Do we have a high-confidence way to reproduce the issue? Yes at source level. Current main preserves manual pairing unless CIDR approval is explicitly configured, while the branch enables SSH verification when the new key is absent; Is this the best way to solve the issue? No, not in its current form. Device-key comparison is a promising opt-in mechanism, but the rollout must preserve the shipped manual default and the subprocess must attest the actual peer rather than a client-configured destination. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c47ceb0f3dcc. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +788, Tests +480, Docs +86. Total +1354 across 30 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
e496e1c to
4aafc62
Compare
Closes #104145
What Problem This Solves
Node device pairing is manual by default: every new node raises an approval prompt the operator must click. For an operator's own fleet, that friction buys little — if you can SSH to the machine you already own it. The one existing opt-in,
gateway.nodes.pairing.autoApproveCidrs, keys trust off network locality (a private CIDR), which is a weak signal a hostile LAN shares. Separately, since #103120 retired the standalone node-pairing store, the macOS app's SSH-probe "silent approval" path went dormant (nothing marks the connect-path capability requestsilent), whiledocs/gateway/pairing.mdstill documented it as live.Why This Change Was Made
Adds
gateway.nodes.pairing.sshVerify(default enabled): for a fresh, scopelessrole: nodepairing from a private/CGNAT address, the gateway SSHes back to the pairing host (BatchMode,StrictHostKeyChecking=yes), runsopenclaw node identity --json, and approves only on an exact device id + public-key match with the pending request. Trust binds to machine ownership (host key + authorized key + on-disk device identity), not network locality — NAT co-tenants, other users on a shared host, and LAN spoofing all fail the key match and fall through to the normal prompt. The probe runs detached off the handshake (the connection still closes with pairing-required; the node's retry loop picks up the approval), is bounded to private ranges, single-flighted per host+device, and cooled down after failures.sshVerify: falsekeeps every node manual; an object form tunes{ user, identity, timeoutMs, cidrs }. The same change marks the first node capability-surface requestsilentwhen device pairing was non-interactive (reviving the macOS SSH-probe approval), auto-approves the first capability surface for ssh-verified devices on the same proof, and adds theopenclaw node identityCLI the probe reads back.Non-goals: no reachability-based approval, no blanket LAN mode, no change to
autoApproveCidrssemantics. Owner boundary stays in the gateway connect/pairing path;ssh-verifiedis a new non-prune-eligiblePairedDeviceApprovalKind.Also fixes a latent store bug this surfaced:
APPROVAL_KINDSindevice-pairing-store.tsis the read-back allowlist for theapproved_viaSQLite column. It was typedreadonly PairedDeviceApprovalKind[], which TypeScript does not exhaustiveness-check, so a new kind silently dropped toundefinedon load. Replaced with aRecord<PairedDeviceApprovalKind, true>that fails compilation if a kind is ever omitted.User Impact
Operators who can SSH to their nodes (including via Tailscale SSH) get promptless node pairing by default, with no key management beyond what SSH already provides. Tailscale-reachable-but-not-SSH hosts still prompt, as does anything failing the key match. Hardeners set
gateway.nodes.pairing.sshVerify: falseto require manual approval for every node. Newopenclaw node identity [--json]prints the local node's device id and public key (read-only; never mints an identity).Evidence
approves device pairing and the first capability surface on a key match, the key-mismatch fall-through, thesshVerify: falsedisable path, the trusted-CIDR auto-approve cases, node-connect-reconcile silent plumbing, and theopenclaw node identityCLI (read-only / fail-closed).pnpm check:changedgreen end-to-end: conflict/attribution/re-export/duplicate/dependency-pin/package-patch guards,typecheck core,typecheck core tests, andlint coreall pass.approvedVia: undefinedwas traced to the SQLite read-back allowlist (approval wrotessh-verifiedin memory;getPairedDevicereadundefined) and fixed with the exhaustiveRecordguard above.Docs updated:
docs/gateway/pairing.md(new SSH-verified section + corrected macOS auto-approval note),configuration-reference.md,security/index.md(trust-boundary rows + not-a-vuln rationale),cli/node.md,cli/nodes.md,cli/devices.md,nodes/index.md.