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. |
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
Low risk schema change confined to auth contract decoding; main risk is unintended behavior if any callers relied on the previous
DateTimeUtcinput shape.Overview
Fixes auth response decoding by switching multiple timestamp fields in
packages/contracts/src/auth.tsfromSchema.DateTimeUtctoSchema.DateTimeUtcFromString(e.g.,expiresAt,issuedAt,createdAt,lastConnectedAt). This aligns contract decoding with HTTP JSON responses that serialize datetimes as ISO strings, unblocking flows like bearer bootstrap/SSH pairing.Reviewed by Cursor Bugbot for commit 978492b. 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 978492b.