feat: Add pre-signed URL support for GET/HEAD requests#424
feat: Add pre-signed URL support for GET/HEAD requests#424lcian wants to merge 4 commits intolcian/feat/presigned-object-authfrom
Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
🤖 This preview updates automatically when you update the PR. |
| (None, Some(jwt)) => AuthContext::from_encoded_jwt(jwt, &state.key_directory), | ||
| (None, None) => Err(AuthError::BadRequest("No authorization provided")), | ||
| }; | ||
|
|
There was a problem hiding this comment.
We need the pre-signed auth to take precedence, because browsers will make requests to the proxy endpoint (or to Objectstore directly, if it were exposed through an NGINX rule) with both an Authorization header and the pre-signature.
Another approach would be to try all 3 methods (2 headers + pre-signature) every time. Or even build a composite AuthContext that takes into account all authentication methods, if multiple of them are present together.
That's more resilient but also more expensive, I would prefer to avoid it.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 449747d. Configure here.
944425c to
570c2ee
Compare
c6ce514 to
0c429ad
Compare
0c429ad to
45d6baf
Compare
|
This is complex:
|

Implements pre-signed URLs that grant time-limited access to specific objects, as an alternative to providing a JWT header.
We will need this for frontend components that rely on Objectstore to provide files (currently only snapshot images and diffs) and we could also use it for e.g. attachments downloads.
Pre-signed URLs are of the form:
Clients expose a
presign_urlutility which takes a private key and creates pre-signed URLs with a customizable TTL, 5 minutes by default.Introduces a new
objectstore-sharedcrate to house the shared signing logic and constants between the client and server crate. We already haveobjectstore-typesthat's similarly shared, but these are not really types, so I think a separate crate is warranted.