From 9df72e0b8a3315c52a44998a24d405bde79ddc01 Mon Sep 17 00:00:00 2001 From: Adam Bronte Date: Wed, 21 Jan 2026 14:25:51 -0800 Subject: [PATCH 1/3] chunk uploadds for large sast scan upload --- src/scan.rs | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/src/scan.rs b/src/scan.rs index a096de5..f766f7a 100644 --- a/src/scan.rs +++ b/src/scan.rs @@ -223,11 +223,43 @@ pub fn upload_scan(config: &Config, paths: Vec, scanner: String, input: println!("Uploading the scan..."); // main scan upload - debug(&format!("POST: {}", scan_upload_url)); - let res = client.post(scan_upload_url) - .header(header::CONTENT_TYPE, "application/json") - .body(input.clone()) - .send(); + let input_bytes = input.as_bytes(); + let input_size = input_bytes.len(); + let max_upload_size = 100 * 1024 * 1024; + let chunk_size = 1024 * 1024; + let res = if input_size > max_upload_size { + let total_chunks = (input_size + chunk_size - 1) / chunk_size; + debug(&format!("Uploading scan in {} chunks", total_chunks)); + let mut offset = 0usize; + let mut last_response = None; + + for (index, chunk) in input_bytes.chunks(chunk_size).enumerate() { + debug(&format!("POST: {} (chunk {}/{})", scan_upload_url, index + 1, total_chunks)); + let response = client.post(&scan_upload_url) + .header(header::CONTENT_TYPE, "application/json") + .header("Upload-Offset", offset.to_string()) + .header("Upload-Length", input_size.to_string()) + .body(chunk.to_vec()) + .send(); + let should_break = match &response { + Ok(res) => !res.status().is_success(), + Err(_) => true, + }; + last_response = Some(response); + if should_break { + break; + } + offset += chunk.len(); + } + + last_response.expect("Failed to upload scan.") + } else { + debug(&format!("POST: {}", scan_upload_url)); + client.post(&scan_upload_url) + .header(header::CONTENT_TYPE, "application/json") + .body(input.clone()) + .send() + }; let mut sast_scan_id: Option = None; From ed9b94a18f446786b46b81843bf0b84b02b0cccd Mon Sep 17 00:00:00 2001 From: Adam Bronte Date: Thu, 22 Jan 2026 12:13:20 -0800 Subject: [PATCH 2/3] change limi to 50 mb for chunk upload --- src/scan.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scan.rs b/src/scan.rs index f766f7a..0337208 100644 --- a/src/scan.rs +++ b/src/scan.rs @@ -225,8 +225,8 @@ pub fn upload_scan(config: &Config, paths: Vec, scanner: String, input: // main scan upload let input_bytes = input.as_bytes(); let input_size = input_bytes.len(); - let max_upload_size = 100 * 1024 * 1024; - let chunk_size = 1024 * 1024; + let max_upload_size = 50 * 1024 * 1024; // 50mb + let chunk_size = 1024 * 1024; // 1mb let res = if input_size > max_upload_size { let total_chunks = (input_size + chunk_size - 1) / chunk_size; debug(&format!("Uploading scan in {} chunks", total_chunks)); From 56794a137eeb01858304c58a5a407cd0b4564a07 Mon Sep 17 00:00:00 2001 From: Adam Bronte Date: Thu, 22 Jan 2026 12:13:47 -0800 Subject: [PATCH 3/3] bump version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bc77206..e1b5d62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -311,7 +311,7 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "corgea" -version = "1.7.1" +version = "1.7.2" dependencies = [ "chrono", "clap", diff --git a/Cargo.toml b/Cargo.toml index 7424851..a9635f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "corgea" -version = "1.7.1" +version = "1.7.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html