Add a server-side API for avatar and header images: uploads are cropped with Vips (400x400 and 1500x500, GIFs passed through, EXIF stripped, transparency flattened to white) and stored as one pending attachment per field. Saving the profile flushes them to the configured Blossom server, authorized by a user-signed kind-24242 token whose x tags cover the stored hashes.
FetchEvent wrapped its wait in Timeout.timeout and FetchLatestEvent
wrapped the relay loop in another one. The nesting leaked
Timeout::ExitException, which is neither a Timeout::Error nor a
StandardError, so it escaped the rescue and surfaced as a 500 on the
metadata endpoint.
- FetchEvent waits on the condition variable with a 5s timeout instead
of Timeout.timeout, and wakes immediately when the relay errors
- FetchLatestEvent uses a monotonic deadline instead of Timeout.timeout,
and skips a relay that raises, so one bad relay cannot abort discovery
- PublishEvent uses thread.join(TIMEOUT) instead of Timeout.timeout
The nostr gem's Event#verify_signature only validates the signature over
the event's claimed id and never recomputes the id from the serialized
body. A genuine (id, sig, pubkey) triple lifted from any public event
could therefore be replayed with injected tags, kind or content and still
pass verification. For Nostr login this allows signing in as the key
owner.
Add NostrManager::VerifySignedEvent, which recomputes the id with
Digest::SHA256.hexdigest(JSON.dump(event.serialize)) and rejects any
mismatch, and use it in the pubkey verification and Nostr login flows.
VerifyAuth now also asserts kind 22242.
Store only SHA256(token) in a new token_digest column and use the digest for the Redis authorization keys instead of the plaintext token. The plaintext is now held in memory only for issuance.
This is the expand step: the plaintext token column stays in place so the old code can keep running during the deploy. A follow-up migration will drop it once rs:rekey_tokens has re-keyed Redis and confirmed no plaintext keys remain.
Refs #259
- Add user_agent to remote_storage_authorizations and rs_authorization_codes
- Capture the browser's user agent at consent, carry it on the authorization
code, and store it on the authorization when the code is exchanged
- Store it directly for the implicit flow too
With the reuse shortcut gone, each authorization is already a distinct
per-device token; this adds the metadata needed to label and display them.
Part of #254
- Enqueue the expiry job and the "app connected" notification on
after_commit instead of after_create, so they only fire once the (now
transactional) code exchange commits
- Enforce the PKCE code_challenge format (43-128 unreserved chars, S256)
with model validations, not only at the controller
- Drop the now-unused RsAuthorizationCode#expired?
- Cover the client_id-vs-stored-client_id check
Part of #254
Implements the optional OAuth 2.0 Authorization Code grant with PKCE
(RFC 7636) for remoteStorage, as described in the remoteStorage spec
(section 10.1).
- Advertise the authorization and token endpoints plus the supported
code_challenge method (S256) in WebFinger, and bump the advertised
spec version to draft-dejong-remotestorage-27
- Add RsAuthorizationCode: a short-lived (5 min), single-use authorization
code stored only as a SHA256 digest
- Add RsOauthManager services for issuing and exchanging codes, including
S256 verification
- Add a cross-origin POST /rs/oauth/token endpoint that exchanges a code
(and code_verifier) for an access token, with CORS and no CSRF token
- Consent dialog now carries response_type / code_challenge through the
form and redirects with the code in the query string for the code flow
- Remove the existing-token reuse shortcut so every authorization results
in a distinct authorization (and token)
Part of #254