-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
base: master
Are you sure you want to change the base?
Changes from 5 commits
35d2923
0dbd02b
d40bd12
b0b0a6e
96ab303
a9b9ff1
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 |
|---|---|---|
|
|
@@ -295,15 +295,25 @@ 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 | ||
| let auth = match authenticated_api.auth() { | ||
| Auth::Token(token) => token.raw().expose_secret().to_owned(), | ||
| }; | ||
| auth | ||
| 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.
Show resolved
Hide resolved
lcian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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 mut scope = Usecase::new("preprod").scope(); | ||
|
|
@@ -400,7 +410,7 @@ fn upload_images( | |
| warn!("Some images share identical file names. Only the first occurrence of each is included:{details}"); | ||
| } | ||
|
|
||
| let result = runtime.block_on(async { many_builder.send().error_for_failures().await }); | ||
| let result = runtime.block_on(async { many_builder.send().await.error_for_failures().await }); | ||
lcian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| let uploaded_count = manifest_entries.len(); | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.