fix(security): harden auto-pair with one-shot exit and shorter timeout#1580
fix(security): harden auto-pair with one-shot exit and shorter timeout#1580
Conversation
…and token cleanup Reduce the auto-pair polling window from 600s to 180s, exit after the first successful approval (one-shot with 5s grace period), clear stale device tokens on startup, explicitly reject non-allowlisted clients, and clear remaining pending requests on timeout. Incorporates ideas from PR #690 with cv's review feedback addressed: the clientId check comment now correctly frames it as defense-in-depth rather than a security boundary, and the one-shot logic uses a break-after-first-approval pattern that prevents deadline re-extension. Supersedes #690 Closes #1310 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughModified the auto-pair watcher embedded in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Closing — this hardens the auto-pair mechanism but doesn't address the root cause of why pairing fails on fresh onboard. Will reopen with a proper fix after investigating. |
Summary
Fixes #1310 — after a fresh
nemoclaw onboard,openclaw tuifails with "Pairing required" because the auto-pair watcher either doesn't approve in time or leaves stale tokens from previous sessions.Supersedes #690 (closed), incorporating cv's review feedback.
Changes to
start_auto_pair()inscripts/nemoclaw-start.sh:openclaw devices clear --yesbefore polling, preventing "Token Mismatch" errors from previous sessions (reported by rp-tn in [NemoClaw][All Platforms] after onboarded, openclaw tui shows "Pairing required. Runopenclaw devices list, approve your request ID, then reconnect." #1310)breakout of the inner loop. TheAPPROVED == 1guard ensures the deadline is only set once (addresses cv's review on fix(security): limit auto-pair to one-shot with 180s timeout #690)openclaw devices rejectinstead of silently skippingopenclaw devices clear --pending --yesin theelseclauseNot changed: The
clientIdallowlist comment was updated to correctly frame it as defense-in-depth, not a security boundary (per cv's review). Real identity validation would need gateway-side changes.Test plan
nemoclaw-start.test.js— 31/31 passnemoclaw onboardwith defaults →nemoclaw <sandbox> connect→openclaw tui→ verify chat works without manual device approval🤖 Generated with Claude Code
Summary by CodeRabbit