fix(ssh): decode auth timestamps from JSON strings#2694
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved Straightforward bug fix that mechanically updates timestamp schema types from You can customize Macroscope's approvability policy. Learn more. |
|
Manually confirmed. I ran into the same issue and was able to fix it by applying the batch from within this PR. |
|
verified locally, this fixed my issue. |
|
Can confirm this fix works for me as well. |
What Changed
Use
Schema.DateTimeUtcFromStringfor auth response timestamp fields that are decoded from HTTP JSON responses.Why
Fixes #2665.
Desktop SSH pairing calls
/api/auth/bootstrap/bearer. The remote server returns HTTP 200 withexpiresAtserialized as an ISO string, but the desktop contract decoder currently expects aDateTimeUtcvalue.That makes pairing fail during
desktop:bootstrap-ssh-bearer-sessioneven though the remote API request succeeds.This fixes the mismatch by using the schema variant that accepts ISO timestamp strings from JSON and decodes them into
DateTime.Utcvalues. The related auth response schemas are updated together because they use the same serialized timestamp shape over HTTP.UI Changes
None.
Checklist
Note
Low Risk
Narrow contract decoder alignment for serialized timestamps; no auth policy or credential logic changes.
Overview
Auth contract schemas now decode HTTP JSON timestamp fields with
DateTimeUtcFromStringinstead ofDateTimeUtc, so ISO 8601 strings from remote auth APIs parse correctly intoDateTime.Utcvalues.The change applies across bootstrap, bearer bootstrap, WebSocket token, pairing credential/link, client session, and session state structs (
expiresAt,createdAt,issuedAt,lastConnectedAt). This unblocks desktop SSH bearer bootstrap when the server returns 200 with stringexpiresAtbut the client previously failed schema decode after the request succeeded.Reviewed by Cursor Bugbot for commit 1565694. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix auth timestamp decoding by switching to
DateTimeUtcFromStringin auth contractsAll timestamp fields in auth-related structs in auth.ts now use
DateTimeUtcFromStringinstead ofDateTimeUtcto correctly parse ISO 8601 datetime strings returned from the SSH auth API. This affectsexpiresAt,issuedAt,createdAt, andlastConnectedAtfields acrossAuthBootstrapResult,AuthBearerBootstrapResult,AuthWebSocketTokenResult,AuthPairingCredentialResult,AuthPairingLink,AuthClientSession, andAuthSessionState.Macroscope summarized 1565694.