From 45ce2a3e4d276ecd80e96e6758a9b7c3a73d7c31 Mon Sep 17 00:00:00 2001 From: Ibrahim Rahhal Date: Sun, 12 Apr 2026 02:45:58 +0300 Subject: [PATCH] Supporting JWT token --- Cargo.toml | 2 +- src/inspect.rs | 6 +-- src/list.rs | 8 ++-- src/main.rs | 6 ++- src/scan.rs | 14 +++--- src/scanners/blast.rs | 30 ++++++------ src/utils/api.rs | 104 +++++++++++++++++------------------------- src/wait.rs | 6 +-- 8 files changed, 80 insertions(+), 96 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1ebb9ba..6e8fdd5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "corgea" -version = "1.8.5" +version = "1.8.6" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/inspect.rs b/src/inspect.rs index e54322c..0933d0c 100644 --- a/src/inspect.rs +++ b/src/inspect.rs @@ -19,7 +19,7 @@ pub fn run( println!(); if *issues { let show_everything = !*summary && !*fix_explanation && !*fix_diff; - let issue_details = match utils::api::get_issue(&config.get_url(), &config.get_token(), id) { + let issue_details = match utils::api::get_issue(&config.get_url(), id) { Ok(issue) => issue, Err(e) => { eprintln!("Failed to fetch issue details for issue ID {} with error:\n{}", id, e); @@ -69,7 +69,7 @@ pub fn run( } } } else { - let scan_details = match utils::api::get_scan(&config.get_url(), &config.get_token(), id) { + let scan_details = match utils::api::get_scan(&config.get_url(), id) { Ok(details) => details, Err(e) => { eprintln!("Failed to fetch scan details for scan ID {}: {}", id, e); @@ -92,7 +92,7 @@ pub fn run( print_section("Engine", &scan_details.engine); let created_at = chrono::DateTime::::from(SystemTime::now()).format("%Y-%m-%d %H:%M:%S").to_string(); print_section("Created At", &created_at); - match scanners::blast::fetch_and_group_scan_issues(&config.get_url(), &config.get_token(), &scan_details.project) { + match scanners::blast::fetch_and_group_scan_issues(&config.get_url(), &scan_details.project) { Ok(counts) => { let total_issues = counts.values().sum::(); let order = vec!["CR", "HI", "ME", "LO"]; diff --git a/src/list.rs b/src/list.rs index f47e143..afacc31 100644 --- a/src/list.rs +++ b/src/list.rs @@ -8,7 +8,7 @@ pub fn run(config: &Config, issues: &bool, sca_issues: &bool, json: &bool, page: let project_name = utils::generic::get_current_working_directory().unwrap_or("unknown".to_string()); println!(""); if *sca_issues { - let sca_issues_response = match utils::api::get_sca_issues(&config.get_url(), &config.get_token(), Some((*page).unwrap_or(1)), *page_size, scan_id.clone()) { + let sca_issues_response = match utils::api::get_sca_issues(&config.get_url(), Some((*page).unwrap_or(1)), *page_size, scan_id.clone()) { Ok(response) => response, Err(e) => { debug(&format!("Error Sending Request: {}", e.to_string())); @@ -87,7 +87,7 @@ pub fn run(config: &Config, issues: &bool, sca_issues: &bool, json: &bool, page: utils::terminal::print_table(table, Some(sca_issues_response.page), Some(sca_issues_response.total_pages)); } else if *issues { - let issues_response = match utils::api::get_scan_issues(&config.get_url(), &config.get_token(), &project_name, Some((*page).unwrap_or(1)), *page_size, scan_id.clone()) { + let issues_response = match utils::api::get_scan_issues(&config.get_url(), &project_name, Some((*page).unwrap_or(1)), *page_size, scan_id.clone()) { Ok(response) => response, Err(e) => { debug(&format!("Error Sending Request: {}", e.to_string())); @@ -115,7 +115,7 @@ pub fn run(config: &Config, issues: &bool, sca_issues: &bool, json: &bool, page: if scan_id.is_some() { let mut page: u32 = 1; loop { - match utils::api::check_blocking_rules(&config.get_url(), &config.get_token(), scan_id.as_ref().unwrap(), Some(page)) { + match utils::api::check_blocking_rules(&config.get_url(), scan_id.as_ref().unwrap(), Some(page)) { Ok(rules) => { if rules.block { render_blocking_rules = true; @@ -224,7 +224,7 @@ pub fn run(config: &Config, issues: &bool, sca_issues: &bool, json: &bool, page: utils::terminal::print_table(table, issues_response.page, issues_response.total_pages); } else { - let (scans, page, total_pages) = match utils::api::query_scan_list(&config.get_url(), &config.get_token(), Some(&project_name), *page, *page_size) { + let (scans, page, total_pages) = match utils::api::query_scan_list(&config.get_url(), Some(&project_name), *page, *page_size) { Ok(scans) => { let page = scans.page; let total_pages = scans.total_pages; diff --git a/src/main.rs b/src/main.rs index a5dfd70..5da00f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -186,7 +186,8 @@ fn main() { eprintln!("No token set.\nPlease run 'corgea login' to authenticate.\nFor more info checkout our docs at Check out our docs at https://docs.corgea.app/install_cli#login-with-the-cli"); std::process::exit(1); } - match utils::api::verify_token(config.get_token().as_str(), config.get_url().as_str()) { + utils::api::set_auth_token(&config.get_token()); + match utils::api::verify_token(config.get_url().as_str()) { Ok(true) => { return; } @@ -207,7 +208,8 @@ fn main() { match effective_token { Some(token_value) => { let token_source = if token.is_some() { "parameter" } else { "CORGEA_TOKEN environment variable" }; - match utils::api::verify_token(&token_value, url.as_deref().unwrap_or(corgea_config.get_url().as_str())) { + utils::api::set_auth_token(&token_value); + match utils::api::verify_token(url.as_deref().unwrap_or(corgea_config.get_url().as_str())) { Ok(true) => { corgea_config.set_token(token_value.clone()).expect("Failed to set token"); if let Some(url) = url { diff --git a/src/scan.rs b/src/scan.rs index 611d800..184dbdd 100644 --- a/src/scan.rs +++ b/src/scan.rs @@ -131,8 +131,8 @@ pub fn upload_scan(config: &Config, paths: Vec, scanner: String, input: let github_env_vars = get_github_env_vars(); let run_id = Uuid::new_v4().to_string(); - let token = config.get_token(); let base_url = config.get_url(); + let api_base = "/api/v1"; let project; if in_ci { @@ -143,20 +143,20 @@ pub fn upload_scan(config: &Config, paths: Vec, scanner: String, input: } else { project = utils::generic::determine_project_name(project_name.as_deref()); } - let repo_data = std::env::var("REPO_DATA").unwrap_or_else(|_| "".to_string()); //encoded data to forward. + let repo_data = std::env::var("REPO_DATA").unwrap_or_else(|_| "".to_string()); let scan_upload_url = if repo_data.is_empty() { format!( - "{}/api/cli/scan-upload?token={}&engine={}&run_id={}&project={}&ci={}&ci_platform={}", base_url, token, scanner, run_id, project, in_ci, ci_platform + "{}{}/scan-upload?engine={}&run_id={}&project={}&ci={}&ci_platform={}", base_url, api_base, scanner, run_id, project, in_ci, ci_platform ) } else { format!( - "{}/api/cli/scan-upload?token={}&engine={}&run_id={}&project={}&ci={}&ci_platform={}&repo_data={}", base_url, token, scanner, run_id, project, in_ci, ci_platform, repo_data + "{}{}/scan-upload?engine={}&run_id={}&project={}&ci={}&ci_platform={}&repo_data={}", base_url, api_base, scanner, run_id, project, in_ci, ci_platform, repo_data ) }; let git_config_upload_url = format!( - "{}/api/cli/git-config-upload?token={}&run_id={}", base_url, token, run_id + "{}{}/git-config-upload?run_id={}", base_url, api_base, run_id ); let client = utils::api::http_client(); @@ -177,7 +177,7 @@ pub fn upload_scan(config: &Config, paths: Vec, scanner: String, input: } let src_upload_url = format!( - "{}/api/cli/code-upload?token={}&run_id={}&path={}", base_url, token, run_id, path + "{}{}/code-upload?run_id={}&path={}", base_url, api_base, run_id, path ); debug(&format!("Uploading file: {}", path)); let fp = Path::new(&path); @@ -404,7 +404,7 @@ pub fn upload_scan(config: &Config, paths: Vec, scanner: String, input: if in_ci { let ci_data_upload_url = format!( - "{}/api/cli/ci-data-upload?token={}&run_id={}&platform={}", base_url, token, run_id, ci_platform + "{}{}/ci-data-upload?run_id={}&platform={}", base_url, api_base, run_id, ci_platform ); let mut github_env_vars_json = serde_json::Map::new(); diff --git a/src/scanners/blast.rs b/src/scanners/blast.rs index 12c093f..d530ed8 100644 --- a/src/scanners/blast.rs +++ b/src/scanners/blast.rs @@ -180,7 +180,7 @@ pub fn run( let _ = packaging_thread.join(); print!("\r{}Project packaged successfully.\n", utils::terminal::set_text_color("", utils::terminal::TerminalColor::Green)); println!("\n\nSubmitting scan to Corgea:"); - let upload_result = match utils::api::upload_zip(&zip_path, &config.get_token(), &config.get_url(), &project_name, repo_info, scan_type, policy) { + let upload_result = match utils::api::upload_zip(&zip_path, &config.get_url(), &project_name, repo_info, scan_type, policy) { Ok(result) => result, Err(e) => { eprintln!("\n\nOh no! We encountered an issue while uploading the zip file '{}' to the server.\nPlease ensure that: @@ -225,7 +225,7 @@ pub fn run( utils::terminal::show_loading_message("Collecting scan results... ([T]s)", stop_signal_clone); }); - let classifications = match report_scan_status(&config.get_url(), &config.get_token(), &project_name) { + let classifications = match report_scan_status(&config.get_url(), &project_name) { Ok(issues_classes) => { *stop_signal.lock().unwrap() = true; let _ = results_thread.join(); @@ -258,7 +258,7 @@ pub fn run( } }; if *fail { - let blocking_rules = match utils::api::check_blocking_rules(&config.get_url(), &config.get_token(), &scan_id, None) { + let blocking_rules = match utils::api::check_blocking_rules(&config.get_url(), &scan_id, None) { Ok(rules) => rules, Err(e) => { eprintln!("Failed to check blocking rules: {}", e); @@ -286,14 +286,14 @@ pub fn run( }); if out_format == "json" { - let issues = match utils::api::get_all_issues(&config.get_url(), &config.get_token(), &project_name, Some(scan_id.clone())) { + let issues = match utils::api::get_all_issues(&config.get_url(), &project_name, Some(scan_id.clone())) { Ok(issues) => issues, Err(e) => { eprintln!("\n\nFailed to fetch issues: {}\n\n", e); std::process::exit(1); } }; - let sca_issues = match utils::api::get_all_sca_issues(&config.get_url(), &config.get_token(), &project_name, Some(scan_id.clone())) { + let sca_issues = match utils::api::get_all_sca_issues(&config.get_url(), &project_name, Some(scan_id.clone())) { Ok(issues) => issues, Err(e) => { eprintln!("\n\nFailed to fetch SCA issues: {}\n\n", e); @@ -311,7 +311,7 @@ pub fn run( println!("\n\nScan results written to: {}\n\n", out_file.clone()); } else if out_format == "html" { - let report = match utils::api::get_scan_report(&config.get_url(), &config.get_token(), &scan_id, None) { + let report = match utils::api::get_scan_report(&config.get_url(), &scan_id, None) { Ok(html) => html, Err(e) => { eprintln!("\n\nFailed to fetch scan report: {}\n\n", e); @@ -325,7 +325,7 @@ pub fn run( println!("\n\nScan report written to: {}\n\n", out_file.clone()); } else if out_format == "sarif" { - let report = match utils::api::get_scan_report(&config.get_url(), &config.get_token(), &scan_id, Some("sarif")) { + let report = match utils::api::get_scan_report(&config.get_url(), &scan_id, Some("sarif")) { Ok(sarif) => sarif, Err(e) => { eprintln!("\n\nFailed to fetch SARIF report: {}\n\n", e); @@ -339,7 +339,7 @@ pub fn run( println!("\n\nScan report written to: {}\n\n", out_file.clone()); } else if out_format == "markdown" { - let report = match utils::api::get_scan_report(&config.get_url(), &config.get_token(), &scan_id, Some("markdown")) { + let report = match utils::api::get_scan_report(&config.get_url(), &scan_id, Some("markdown")) { Ok(markdown) => markdown, Err(e) => { eprintln!("\n\nFailed to fetch Markdown report: {}\n\n", e); @@ -402,7 +402,7 @@ pub fn wait_for_scan(config: &Config, scan_id: &str) { loop { std::thread::sleep(std::time::Duration::from_secs(1)); - match check_scan_status(&scan_id, &config.get_url(), &config.get_token()) { + match check_scan_status(&scan_id, &config.get_url()) { Ok(true) => { *stop_signal.lock().unwrap() = true; break; @@ -444,16 +444,16 @@ pub fn wait_for_scan(config: &Config, scan_id: &str) { } -pub fn check_scan_status(scan_id: &str, url: &str, token: &str) -> Result> { - match utils::api::get_scan(url, token, scan_id) { +pub fn check_scan_status(scan_id: &str, url: &str) -> Result> { + match utils::api::get_scan(url, scan_id) { Ok(scan) => Ok(scan.status == "complete"), Err(e) => Err(e) } } -pub fn fetch_and_group_scan_issues(url: &str, token: &str, project: &str) -> Result, Box> { - let issues = match utils::api::get_all_issues(url, token, project, None) { +pub fn fetch_and_group_scan_issues(url: &str, project: &str) -> Result, Box> { + let issues = match utils::api::get_all_issues(url, project, None) { Ok(issues) => issues, Err(err) => { return Err(format!("Failed to fetch scan issues: {}", err).into()); @@ -468,8 +468,8 @@ pub fn fetch_and_group_scan_issues(url: &str, token: &str, project: &str) -> Res Ok(classification_counts) } -pub fn report_scan_status(url: &str, token: &str, project: &str) -> Result, Box>{ - let classification_counts = match fetch_and_group_scan_issues(url, token, project) { +pub fn report_scan_status(url: &str, project: &str) -> Result, Box>{ + let classification_counts = match fetch_and_group_scan_issues(url, project) { Ok(counts) => counts, Err(e) => { return Err(e); diff --git a/src/utils/api.rs b/src/utils/api.rs index e7623f2..f0e8a59 100644 --- a/src/utils/api.rs +++ b/src/utils/api.rs @@ -19,6 +19,32 @@ fn get_source() -> String { std::env::var("CORGEA_SOURCE").unwrap_or_else(|_| "cli".to_string()) } +fn is_jwt(token: &str) -> bool { + let parts: Vec<&str> = token.splitn(4, '.').collect(); + parts.len() == 3 && parts.iter().all(|p| !p.is_empty()) +} + +fn auth_headers(token: &str) -> HeaderMap { + let mut headers = HeaderMap::new(); + if is_jwt(token) { + headers.insert( + "Authorization", + format!("Bearer {}", token).parse().unwrap(), + ); + } else { + headers.insert("CORGEA-TOKEN", token.parse().unwrap()); + } + headers.insert("CORGEA-SOURCE", get_source().parse().unwrap()); + headers +} + +static AUTH_TOKEN: std::sync::LazyLock> = + std::sync::LazyLock::new(|| std::sync::RwLock::new(String::new())); + +pub fn set_auth_token(token: &str) { + *AUTH_TOKEN.write().unwrap() = token.to_string(); +} + static COOKIE_JAR: std::sync::LazyLock> = std::sync::LazyLock::new(|| std::sync::Arc::new(reqwest::cookie::Jar::default())); @@ -74,10 +100,6 @@ impl DebugRequestBuilder { Self { inner: self.inner.header(key, value), client: self.client } } - pub fn headers(self, headers: reqwest::header::HeaderMap) -> Self { - Self { inner: self.inner.headers(headers), client: self.client } - } - pub fn query(self, query: &T) -> Self { Self { inner: self.inner.query(query), client: self.client } } @@ -93,7 +115,14 @@ impl DebugRequestBuilder { pub fn send(self) -> reqwest::Result { use reqwest::cookie::CookieStore; - let request = self.inner.build()?; + let token = AUTH_TOKEN.read().unwrap().clone(); + let builder = if !token.is_empty() { + self.inner.headers(auth_headers(&token)) + } else { + self.inner + }; + + let request = builder.build()?; debug(&format!("→ {} {}", request.method(), request.url())); debug(&format!(" Request headers: {:?}", request.headers())); @@ -138,7 +167,6 @@ pub struct UploadZipResult { pub fn upload_zip( file_path: &str, - token: &str, url: &str, project_name: &str, repo_info: Option, @@ -164,8 +192,6 @@ pub fn upload_zip( let response_object = client .post(format!("{}{}/start-scan", url, API_BASE)) - .header("CORGEA-TOKEN", token) - .header("CORGEA-SOURCE", get_source()) .query(&[ ("scan_type", "blast"), ]) @@ -254,8 +280,6 @@ pub fn upload_zip( let response = match client .patch(format!("{}{}/start-scan/{}/", url, API_BASE, transfer_id)) - .header("CORGEA-TOKEN", token) - .header("CORGEA-SOURCE", get_source()) .header("Upload-Offset", offset.to_string()) .header("Upload-Length", file_size.to_string()) .header("Upload-Name", file_name) @@ -316,12 +340,12 @@ pub fn upload_zip( Err("Failed to upload file".into()) } -pub fn get_all_issues(url: &str, token: &str, project: &str, scan_id: Option) -> Result, Box> { +pub fn get_all_issues(url: &str, project: &str, scan_id: Option) -> Result, Box> { let mut all_issues = Vec::new(); let mut current_page: u32 = 1; loop { - let response = match get_scan_issues(url, token, project, Some(current_page as u16), Some(30), scan_id.clone()) { + let response = match get_scan_issues(url, project, Some(current_page as u16), Some(30), scan_id.clone()) { Ok(response) => response, Err(e) => return Err(format!("Failed to get scan issues: {}", e).into()) }; @@ -347,7 +371,6 @@ pub fn get_all_issues(url: &str, token: &str, project: &str, scan_id: Option, page_size: Option, @@ -375,14 +398,10 @@ pub fn get_scan_issues( url.push_str("&page_size=30"); } let client = http_client(); - let mut headers = HeaderMap::new(); - headers.insert("CORGEA-TOKEN", token.parse().unwrap()); - headers.insert("CORGEA-SOURCE", get_source().parse().unwrap()); debug(&format!("Sending request to URL: {}", url)); - debug(&format!("Headers: {:?}", headers)); - let response = match client.get(&url).headers(headers).send() { + let response = match client.get(&url).send() { Ok(res) => { check_for_warnings(res.headers(), res.status()); res @@ -404,19 +423,13 @@ pub fn get_scan_issues( } } -pub fn get_scan(url: &str, token: &str, scan_id: &str) -> Result> { +pub fn get_scan(url: &str, scan_id: &str) -> Result> { let url = format!("{}{}/scan/{}", url, API_BASE, scan_id); let client = http_client(); - - let mut headers = HeaderMap::new(); - headers.insert("CORGEA-TOKEN", token.parse().unwrap()); - headers.insert("CORGEA-SOURCE", get_source().parse().unwrap()); debug(&format!("Sending request to URL: {}", url)); - debug(&format!("Headers: {:?}", headers)); let response = client .get(&url) - .headers(headers) .send() .map_err(|e| format!("Failed to send request: {}", e))?; @@ -434,7 +447,7 @@ pub fn get_scan(url: &str, token: &str, scan_id: &str) -> Result) -> Result> { +pub fn get_scan_report(url: &str, scan_id: &str, format: Option<&str>) -> Result> { let url = if let Some(fmt) = format { format!("{}{}/scan/{}/report?format={}", url, API_BASE, scan_id, fmt) } else { @@ -442,16 +455,11 @@ pub fn get_scan_report(url: &str, token: &str, scan_id: &str, format: Option<&st }; let client = http_client(); - let mut headers = HeaderMap::new(); - headers.insert("CORGEA-TOKEN", token.parse().unwrap()); - headers.insert("CORGEA-SOURCE", get_source().parse().unwrap()); debug(&format!("Sending request to URL: {}", url)); - debug(&format!("Headers: {:?}", headers)); let response = client .get(&url) - .headers(headers) .send() .map_err(|e| format!("Failed to send request: {}", e))?; @@ -464,7 +472,7 @@ pub fn get_scan_report(url: &str, token: &str, scan_id: &str, format: Option<&st } } -pub fn get_issue(url: &str, token: &str, issue: &str) -> Result> { +pub fn get_issue(url: &str, issue: &str) -> Result> { let url = format!( "{}{}/issue/{}", url, @@ -472,12 +480,8 @@ pub fn get_issue(url: &str, token: &str, issue: &str) -> Result { check_for_warnings(res.headers(), res.status()); res @@ -498,7 +502,6 @@ pub fn get_issue(url: &str, token: &str, issue: &str) -> Result, page: Option, page_size: Option @@ -517,14 +520,9 @@ pub fn query_scan_list( let client = http_client(); - let mut headers = HeaderMap::new(); - headers.insert("CORGEA-TOKEN", token.parse().unwrap()); - headers.insert("CORGEA-SOURCE", get_source().parse().unwrap()); debug(&format!("Sending request to URL: {}", url)); - debug(&format!("Headers: {:?}", headers)); let response = match client .get(url) - .headers(headers) .query(&query_params) .send() { Ok(res) => { @@ -578,18 +576,13 @@ pub fn exchange_code_for_token( } } -pub fn verify_token(token: &str, corgea_url: &str) -> Result> { +pub fn verify_token(corgea_url: &str) -> Result> { let url = format!("{}{}/verify", corgea_url, API_BASE); let client = http_client(); - let mut headers = HeaderMap::new(); - headers.insert("CORGEA-TOKEN", token.parse().unwrap()); - headers.insert("CORGEA-SOURCE", get_source().parse().unwrap()); debug(&format!("Sending request to URL: {}", url)); - debug(&format!("Headers: {:?}", headers)); let response = client .get(&url) - .headers(headers) .send()?; check_for_warnings(response.headers(), response.status()); @@ -612,7 +605,6 @@ pub fn verify_token(token: &str, corgea_url: &str) -> Result ) -> Result> { @@ -621,16 +613,11 @@ pub fn check_blocking_rules( let query_params = vec![("page", page.to_string())]; let client = http_client(); - let mut headers = HeaderMap::new(); - headers.insert("CORGEA-TOKEN", token.parse().unwrap()); - headers.insert("CORGEA-SOURCE", get_source().parse().unwrap()); debug(&format!("Sending request to URL: {}", url)); - debug(&format!("Headers: {:?}", headers)); debug(&format!("Query params: {:?}", query_params)); let response = match client .get(url) - .headers(headers) .query(&query_params) .send() { Ok(res) => { @@ -663,7 +650,6 @@ pub fn check_blocking_rules( pub fn get_sca_issues( url: &str, - token: &str, page: Option, page_size: Option, scan_id: Option @@ -685,12 +671,9 @@ pub fn get_sca_issues( debug(&format!("Sending request to URL: {}", endpoint)); debug(&format!("Query params: {:?}", query_params)); - debug(&format!("Token: {}", token)); let response = client .get(&endpoint) - .header("CORGEA-TOKEN", token) - .header("CORGEA-SOURCE", get_source()) .query(&query_params) .send(); @@ -726,7 +709,6 @@ pub fn get_sca_issues( pub fn get_all_sca_issues( url: &str, - token: &str, _project: &str, scan_id: Option ) -> Result, Box> { @@ -734,7 +716,7 @@ pub fn get_all_sca_issues( let mut current_page: u32 = 1; loop { - let response = match get_sca_issues(url, token, Some(current_page as u16), Some(30), scan_id.clone()) { + let response = match get_sca_issues(url, Some(current_page as u16), Some(30), scan_id.clone()) { Ok(response) => response, Err(e) => return Err(format!("Failed to get SCA issues: {}", e).into()) }; diff --git a/src/wait.rs b/src/wait.rs index e49ea1d..c0ce3e7 100644 --- a/src/wait.rs +++ b/src/wait.rs @@ -12,7 +12,7 @@ pub fn run(config: &Config, scan_id: Option, project_id: Option) } }; - let scans_result = utils::api::query_scan_list(&config.get_url(), &config.get_token(), Some(&project_name), Some(1), None); + let scans_result = utils::api::query_scan_list(&config.get_url(), Some(&project_name), Some(1), None); let scans: Vec = match scans_result { Ok(result) => result.scans.unwrap_or_default(), Err(e) => { @@ -31,7 +31,7 @@ pub fn run(config: &Config, scan_id: Option, project_id: Option) }; let (scan_id, processed) = match scan_id { Some(scan_id) => { - let processed = match blast::check_scan_status(&scan_id, &config.get_url(), &config.get_token()) { + let processed = match blast::check_scan_status(&scan_id, &config.get_url()) { Ok(processed) => processed, Err(_) => { eprintln!( @@ -73,7 +73,7 @@ pub fn run(config: &Config, scan_id: Option, project_id: Option) print!("Scan has been processed successfully!\n"); } - match blast::report_scan_status(&config.get_url(), &config.get_token(), &project_name) { + match blast::report_scan_status(&config.get_url(), &project_name) { Ok(_) => { println!( "\n\nYou can view the scan results at the following link:\n{}",