Repository navigation
Use Gateway challenge time for node authentication - #1067
shanselman merged 2 commits into
Conversation
Co-authored-by: Copilot App <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed July 29, 2026, 8:52 PM ET / July 30, 2026, 00:52 UTC. ClawSweeper reviewWhat this changesThis PR makes Windows node device-auth signatures use a valid timestamp from the Gateway's connect challenge, matching the operator path, and adds coverage for timestamp selection and terminal authentication errors. Merge readinessKeep this collaborator-authored PR open for explicit maintainer merge review. The proposed shared timestamp selection fixes the operator/node authentication asymmetry, has focused regression coverage, and the supplied current-head Gateway setup and recovery proof is substantive; no concrete patch defect was identified in the reviewed change context. Priority: P1 Review scores
Verification
How this fits togetherGateway connection setup receives a challenge containing a nonce and timestamp, then both the operator client and Windows node sign an authentication payload. The Gateway validates that signature before pairing and keeping the node connected, so a host-clock mismatch can otherwise make only node authentication fail. flowchart LR
A[Gateway connect challenge] --> B[Challenge timestamp selection]
B --> C[Operator authentication signature]
B --> D[Windows node authentication signature]
C --> E[Gateway signature validation]
D --> E
E --> F[Pairing and connection state]
Decision needed
Why: The patch is narrowly implemented and proof-positive, but choosing the permanent device-auth compatibility contract is a maintainer-owned protocol decision. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one shared Gateway-challenge timestamp policy for operator and node signatures, retain the invalid-or-absent host-time fallback, and land it once a maintainer confirms the supported Gateway compatibility contract. Do we have a high-confidence way to reproduce the issue? Yes. A controlled Gateway challenge whose timestamp differs from the Windows host clock provides a high-confidence source-level reproduction: current node signing uses host UTC while the Gateway validates challenge-relative freshness; the PR's deterministic 130-second-skew coverage exercises that boundary. Is this the best way to solve the issue? Yes. Sharing one validated timestamp selector between operator and node authentication is the narrowest maintainable repair because it removes the split source of truth while preserving host-time fallback for absent or invalid challenge data. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c04c5fb06238. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Co-authored-by: Copilot App <[email protected]> # Conflicts: # src/OpenClaw.Shared/WindowsNodeClient.cs # tests/OpenClaw.Shared.Tests/WindowsNodeClientTests.cs
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Related to #677
Current head:
17f9e618aad128168f4ef575382bb00b0402cd0fRoot cause
The reporter's new WSL Gateway clock was consistently about 130 seconds behind Windows. Operator pairing signed with the Gateway
connect.challenge.ts, butWindowsNodeClientdiscarded that supplied timestamp and signeddevice.signedAtwith Windows host UTC. The Gateway correctly rejected the stale node signature withDEVICE_AUTH_SIGNATURE_EXPIRED, so operator pairing succeeded while node pairing failed deterministically.Regression provenance: node host-clock signing originated in
e3eeef33(feat: add Windows node mode capabilities). PR #117 /1d836390later added Gateway challenge-timestamp signing only to the operator path, leaving the node/operator asymmetry in place.Behavior and invariants
device.signedAtand the signed payload use the same selected timestamp for both protocol v2 and v3.DEVICE_AUTH_SIGNATURE_EXPIREDis terminal and overrides generic invalid-signature text, so it cannot trigger blind reconnect or v2 fallback. The emitted failure remains classifiable as authentication failure.code,reason, and validated pairing request IDs.mainchanges from Keep Windows device metadata stable across reconnects #1064 and Fail closed when persisted device identity cannot load #1065 are preserved. The merge resolution retains stable Windows metadata, fail-closed identity loading, and the current-main invariant that reconnectable server errors do not emit terminal connection failures.Scope
Setup rollback behavior remains unchanged by product decision. This PR includes no WSL lifecycle changes, destructive cleanup, setup rollback changes, or credential migration behavior.
Validation
Current merged head:
./build.ps1: 5 projects built, 0 failed, 0 warningsgit diff --check upstream/main: cleanmain: exactly 6 intended filesReal behavior proof
Deterministic 130-second skew proof: Credential-free in-memory handshake proof modeled the reporter's approximately 130-second Windows/Gateway skew. The fake Gateway accepted the node connect request because serialized
signedAtused the challenge time instead of host UTC. Tests independently recomputed and matched v2 and v3 signatures, covered challenge timestamps without nonce, and verified terminal structured expiry across direct, nested, malformed, incomplete, and mixed generic-message shapes. The current-main reconnectable-error invariant also passed.Real current-Gateway protocol compatibility: Hosted CI used fresh isolated WSL distros and pinned Gateway
2026.6.11on the current PR head.ConnectedwithnodeConnected=trueandnodePaired=true;FullSetup_TrayConnects_OperatorAndNodepassed.nodeConnected=true,nodePaired=true.nodeConnected=true,nodePaired=trueeach time.system.runtests skipped because AppContainer/MXC is unavailable on GitHub-hosted runners. They are unrelated to the timestamp selector; initial pairing and both recovery lanes executed against the real Gateway.Naturally skewed host proof: Not verified. No naturally skewed Windows/WSL host is available. The deterministic test injects the exact 130-second skew without weakening Gateway freshness checks.
No real user credentials, live user Gateway, user settings, or user WSL state were modified. Local real-Gateway E2E was not run because this host already has four leftover
OpenClawE2E-*distros and one is the default, so another destructive fixture run would not satisfy the isolation requirement.Review
Independent review findings covering terminal-code precedence, downstream auth classification, malformed and incomplete detail fallback, per-field pairing detail extraction, and nonce-independent timestamp parsing were fixed. Current-head rubber-duck re-review found no significant issues after merging
main.Structured autoreview command:
python .agents\skills\autoreview\scripts\autoreview --mode branch --base upstream/main --stream-engine-output. Codexgpt-5.6-solat high reasoning was blocked before findings by HTTP 401 Unauthorized.