corgea-cli 1.3.1__tar.gz → 1.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/Cargo.lock +1 -1
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/Cargo.toml +1 -1
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/PKG-INFO +1 -1
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/src/scan.rs +46 -22
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/.github/workflows/release.yml +0 -0
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/.gitignore +0 -0
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/LICENSE +0 -0
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/README.md +0 -0
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/build_release.sh +0 -0
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/pyproject.toml +0 -0
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/src/cicd.rs +0 -0
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/src/config.rs +0 -0
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/src/log.rs +0 -0
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/src/login.rs +0 -0
- {corgea_cli-1.3.1 → corgea_cli-1.3.2}/src/main.rs +0 -0
|
@@ -144,7 +144,7 @@ pub fn parse_scan(config: &Config, input: String, save_to_file: bool) {
|
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
// checkmarx report generated by CLI
|
|
147
|
-
} else if
|
|
147
|
+
} else if data.get("totalCount").is_some() && data.get("results").is_some() && data.get("scanID").is_some() {
|
|
148
148
|
debug("Detected checkmarx cli schema");
|
|
149
149
|
scanner = "checkmarx".to_string();
|
|
150
150
|
if let Some(results) = data.get("results").and_then(|v| v.as_array()) {
|
|
@@ -163,7 +163,7 @@ pub fn parse_scan(config: &Config, input: String, save_to_file: bool) {
|
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
// for checkmarx report generated by web
|
|
166
|
-
} else if
|
|
166
|
+
} else if data.get("scanResults").is_some() && data.get("reportId").is_some() {
|
|
167
167
|
debug("Detected checkmarx web schema");
|
|
168
168
|
scanner = "checkmarx".to_string();
|
|
169
169
|
if let Some(scan_results) = data.get("scanResults") {
|
|
@@ -244,6 +244,8 @@ fn upload_scan(config: &Config, paths: Vec<String>, scanner: String, input: Stri
|
|
|
244
244
|
println!("Uploading required files for the scan...");
|
|
245
245
|
|
|
246
246
|
let mut uploaded_paths = HashSet::new();
|
|
247
|
+
let mut uploaded_count = 0;
|
|
248
|
+
let mut upload_error_count = 0;
|
|
247
249
|
|
|
248
250
|
for path in &paths {
|
|
249
251
|
if !Path::new(&path).exists() {
|
|
@@ -261,30 +263,47 @@ fn upload_scan(config: &Config, paths: Vec<String>, scanner: String, input: Stri
|
|
|
261
263
|
debug(&format!("Uploading file: {}", path));
|
|
262
264
|
let fp = Path::new(&path);
|
|
263
265
|
|
|
264
|
-
let
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
266
|
+
let mut attempts = 0;
|
|
267
|
+
let mut success = false;
|
|
268
|
+
|
|
269
|
+
while attempts < 3 && !success {
|
|
270
|
+
let form = reqwest::blocking::multipart::Form::new()
|
|
271
|
+
.file("file", fp)
|
|
272
|
+
.expect("Failed to read file");
|
|
273
|
+
|
|
274
|
+
debug(&format!("POST: {}", src_upload_url));
|
|
275
|
+
let res = client.post(&src_upload_url)
|
|
276
|
+
.multipart(form)
|
|
277
|
+
.send();
|
|
278
|
+
|
|
279
|
+
match res {
|
|
280
|
+
Ok(response) => {
|
|
281
|
+
if !response.status().is_success() {
|
|
282
|
+
eprintln!("Failed to upload file {} {}... retrying", response.status(), path);
|
|
283
|
+
std::thread::sleep(std::time::Duration::from_secs(1));
|
|
284
|
+
upload_error_count = upload_error_count + 1;
|
|
285
|
+
attempts += 1;
|
|
286
|
+
} else {
|
|
287
|
+
uploaded_count += 1;
|
|
288
|
+
success = true;
|
|
289
|
+
uploaded_paths.insert(path.clone());
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
Err(e) => {
|
|
293
|
+
eprintln!("Failed to send request: {}", e);
|
|
278
294
|
std::process::exit(1);
|
|
279
|
-
} else {
|
|
280
|
-
uploaded_paths.insert(path.clone());
|
|
281
295
|
}
|
|
282
296
|
}
|
|
283
|
-
Err(e) => {
|
|
284
|
-
eprintln!("Failed to send request: {}", e);
|
|
285
|
-
std::process::exit(1);
|
|
286
|
-
}
|
|
287
297
|
}
|
|
298
|
+
|
|
299
|
+
if attempts == 3 && !success {
|
|
300
|
+
eprintln!("Failed to upload file: {} after 3 attempts. skipping...", path);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if uploaded_count == 0 {
|
|
305
|
+
eprintln!("Failed to upload any files for the scan, exiting.");
|
|
306
|
+
std::process::exit(1);
|
|
288
307
|
}
|
|
289
308
|
|
|
290
309
|
println!("Uploading the scan...");
|
|
@@ -371,5 +390,10 @@ fn upload_scan(config: &Config, paths: Vec<String>, scanner: String, input: Stri
|
|
|
371
390
|
}
|
|
372
391
|
|
|
373
392
|
println!("Successfully scanned using {} and uploaded to Corgea.", scanner);
|
|
393
|
+
|
|
394
|
+
if upload_error_count > 0 {
|
|
395
|
+
println!("Failed to upload {} files, you may not see all fixes in Corgea.", upload_error_count);
|
|
396
|
+
}
|
|
397
|
+
|
|
374
398
|
println!("Go to {base_url} to see results.");
|
|
375
399
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|