Skip to content

fix(rsky-pds): getServiceAuth exp is seconds, not milliseconds#207

Open
rudyfraser wants to merge 2 commits into
mainfrom
fix/service-auth-exp-micros
Open

fix(rsky-pds): getServiceAuth exp is seconds, not milliseconds#207
rudyfraser wants to merge 2 commits into
mainfrom
fix/service-auth-exp-micros

Conversation

@rudyfraser

Copy link
Copy Markdown
Member

Summary

Follow-up to #206. getServiceAuth converted its exp param (a Unix timestamp in seconds, per the lexicon) with exp * 1_000 (milliseconds) before passing it to from_micros_to_utc. Since #206 that function correctly interprets its argument as microseconds, so the value was 1000x too small, landed near 1970, and every request with a requested exp failed BadExpiration: expiration is in past. This converts with 1_000_000 and extracts the bounds check into a pure, testable helper.

Note (separate, not fixed here)

inner_get_service_auth validates the requested exp but then passes exp: None to create_service_jwt, so the minted token always uses the default 60s lifetime regardless of the (now correctly validated) request. Left for a separate change to keep this scoped to the unit bug.

Test plan

  • cargo test -p rsky-pds --lib get_service_auth — 5 regression tests (valid 30-min and sub-minute method-less expiries accepted; past, >1h, and >1min-method-less rejected). All fail on the previous * 1_000 and pass on the fix.

exp is a Unix timestamp in seconds (per the lexicon) but was multiplied by
1_000 (milliseconds) before from_micros_to_utc, which since #206 correctly
interprets its argument as microseconds. The 1000x-too-small value landed
near 1970, so every getServiceAuth with a requested exp failed
BadExpiration "expiration is in past". Convert with 1_000_000 and extract
the bounds check into a testable helper with regression tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant