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)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. |
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, contract-only change that adjusts timestamp decoding for auth responses; main risk is if any producer sends non-ISO strings where
DateTimeUtcwas previously expected.Overview
Fixes a contract mismatch in
packages/contracts/src/auth.tsby switching auth response/session timestamp fields (e.g.expiresAt,createdAt,issuedAt,lastConnectedAt) fromSchema.DateTimeUtctoSchema.DateTimeUtcFromString.This ensures HTTP JSON auth endpoints (including bearer bootstrap and pairing/session metadata) decode ISO timestamp strings correctly instead of failing during schema decoding.
Reviewed by Cursor Bugbot for commit c7d54ef. 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 c7d54ef.