-
-
Notifications
You must be signed in to change notification settings - Fork 244
feat(snapshots): Authenticate with Objectstore #3258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8e2df9e
461917f
c6c3587
69d5972
dd4b3f7
f6278b8
0250f69
3fb1d52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -332,14 +332,26 @@ fn upload_images( | |
| let expiration = ExpirationPolicy::from_str(&options.objectstore.expiration_policy) | ||
| .context("Failed to parse expiration policy from upload options")?; | ||
|
|
||
| let client = ClientBuilder::new(options.objectstore.url) | ||
| .token({ | ||
| // TODO: replace with auth from `ObjectstoreUploadOptions` when appropriate | ||
| match authenticated_api.auth() { | ||
| Auth::Token(token) => token.raw().expose_secret().to_owned(), | ||
| } | ||
| let mut builder = ClientBuilder::new(options.objectstore.url); | ||
| if let Some(token) = options.objectstore.auth_token { | ||
| builder = builder.token(token.expose_secret().to_owned()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. l: Why not implement I think that probably reduces the scope where the secret string could accidentally get leaked in a panic.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As we discussed previously, internally the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could place the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. but this comment is nonblocking in any case |
||
| } | ||
|
sentry[bot] marked this conversation as resolved.
lcian marked this conversation as resolved.
|
||
| let builder = builder; | ||
|
|
||
| let sentry_token = match authenticated_api.auth() { | ||
| Auth::Token(token) => token.raw().expose_secret().to_owned(), | ||
| }; | ||
| let sentry_token = format!("Bearer {sentry_token}") | ||
| .parse() | ||
| // Ignore original error to avoid leaking the token (even though it's invalid) | ||
| .map_err(|_| anyhow::anyhow!("Invalid auth token"))?; | ||
| let client = builder | ||
| .configure_reqwest(|r| { | ||
| let mut headers = http::HeaderMap::new(); | ||
| headers.insert(http::header::AUTHORIZATION, sentry_token); | ||
| r.connect_timeout(Duration::from_secs(10)) | ||
| .default_headers(headers) | ||
| }) | ||
| .configure_reqwest(|r| r.connect_timeout(Duration::from_secs(10))) | ||
| .build()?; | ||
|
|
||
| let scopes = options.objectstore.scopes; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.