diff --git a/crates/symbolicator-native/src/interface.rs b/crates/symbolicator-native/src/interface.rs index 3bbbb7fe4..f6f152e21 100644 --- a/crates/symbolicator-native/src/interface.rs +++ b/crates/symbolicator-native/src/interface.rs @@ -74,7 +74,10 @@ pub enum AttachmentFile { /// The attachment has been stored on the local system already. Local(File), /// The attachment needs to be fetched from the remote url. - Remote(String), + Remote { + storage_url: String, + storage_token: Option, + }, } /// A request to process (stackwalk + symbolicate) a minidump. diff --git a/crates/symbolicator-native/src/symbolication/attachments.rs b/crates/symbolicator-native/src/symbolication/attachments.rs index ffca1dfce..8c6378535 100644 --- a/crates/symbolicator-native/src/symbolication/attachments.rs +++ b/crates/symbolicator-native/src/symbolication/attachments.rs @@ -12,9 +12,12 @@ pub async fn download_attachment( download_svc: &DownloadService, file: AttachmentFile, ) -> anyhow::Result { - let storage_url = match file { + let (storage_url, storage_token) = match file { AttachmentFile::Local(file) => return Ok(file), - AttachmentFile::Remote(url) => url, + AttachmentFile::Remote { + storage_url, + storage_token, + } => (storage_url, storage_token), }; // TODO: maybe its worth using the actual `DownloadService` instead of straight going to the `trusted_client`. @@ -22,9 +25,11 @@ pub async fn download_attachment( // download files in multiple chunks concurrently, but I don’t think our `objecstore` server currently // supports range requests, and those would also mess with streaming decompression. // Not to mention that using the `DownloadService` is not that straight forward. - let stream = download_svc - .trusted_client - .get(storage_url) + let mut request = download_svc.trusted_client.get(storage_url); + if let Some(token) = storage_token { + request = request.bearer_auth(token); + } + let stream = request .send() .await? .error_for_status()? diff --git a/crates/symbolicator-native/tests/integration/process_minidump.rs b/crates/symbolicator-native/tests/integration/process_minidump.rs index 19a3b29d0..07fe86e9d 100644 --- a/crates/symbolicator-native/tests/integration/process_minidump.rs +++ b/crates/symbolicator-native/tests/integration/process_minidump.rs @@ -105,9 +105,10 @@ async fn test_minidump_attachment_download() { .process_minidump(ProcessMinidump { platform: None, scope: Scope::Global, - minidump_file: AttachmentFile::Remote( - attachment_server.url("/the_minidump.dmp").to_string(), - ), + minidump_file: AttachmentFile::Remote { + storage_url: attachment_server.url("/the_minidump.dmp").to_string(), + storage_token: None, + }, sources: Arc::new([source]), scraping: Default::default(), rewrite_first_module: Default::default(), diff --git a/crates/symbolicator/src/endpoints/symbolicate_any.rs b/crates/symbolicator/src/endpoints/symbolicate_any.rs index d67bc135b..a3073faff 100644 --- a/crates/symbolicator/src/endpoints/symbolicate_any.rs +++ b/crates/symbolicator/src/endpoints/symbolicate_any.rs @@ -40,10 +40,12 @@ pub struct SymbolicateAnyRequestBody { pub enum SymbolicationRequest { Minidump { storage_url: String, + storage_token: Option, rewrite_first_module: RewriteRules, }, AppleCrashreport { storage_url: String, + storage_token: Option, }, // TODO: it should be possible to also support native, js and jvm requests here as well } @@ -60,27 +62,36 @@ pub async fn symbolicate_any( let request_id = match body.symbolicate { SymbolicationRequest::Minidump { storage_url, + storage_token, rewrite_first_module, } => service.process_minidump( ProcessMinidump { platform: body.platform, scope: params.scope, - minidump_file: AttachmentFile::Remote(storage_url), + minidump_file: AttachmentFile::Remote { + storage_url, + storage_token, + }, sources: body.sources, scraping: body.scraping, rewrite_first_module, }, body.options, )?, - SymbolicationRequest::AppleCrashreport { storage_url } => service - .process_apple_crash_report( - body.platform, - params.scope, - AttachmentFile::Remote(storage_url), - body.sources, - body.scraping, - body.options, - )?, + SymbolicationRequest::AppleCrashreport { + storage_url, + storage_token, + } => service.process_apple_crash_report( + body.platform, + params.scope, + AttachmentFile::Remote { + storage_url, + storage_token, + }, + body.sources, + body.scraping, + body.options, + )?, }; match service.get_response(request_id, params.timeout).await {