corgea-cli 1.8.1__tar.gz → 1.8.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.8.1 → corgea_cli-1.8.2}/Cargo.lock +1 -1
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/Cargo.toml +1 -1
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/PKG-INFO +1 -1
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/main.rs +12 -6
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/scan.rs +12 -13
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/scanners/fortify.rs +2 -2
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/.github/workflows/npm-publish.yml +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/.github/workflows/release-binaries.yml +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/.github/workflows/release.yml +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/.github/workflows/test.yml +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/.github/workflows/update_docs..yml +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/.gitignore +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/LICENSE +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/README.md +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/bin/corgea.js +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/build_release.sh +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/package.json +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/pyproject.toml +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/scripts/npm/bundle-binaries.js +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/authorize.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/cicd.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/config.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/inspect.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/list.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/log.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/scanners/blast.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/scanners/parsers/checkmarx.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/scanners/parsers/coverity.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/scanners/parsers/mod.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/scanners/parsers/sarif.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/scanners/parsers/semgrep.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/setup_hooks.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/targets.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/utils/api.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/utils/generic.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/utils/terminal.rs +0 -0
- {corgea_cli-1.8.1 → corgea_cli-1.8.2}/src/wait.rs +0 -0
|
@@ -52,6 +52,12 @@ enum Commands {
|
|
|
52
52
|
Upload {
|
|
53
53
|
/// Option path to JSON report to upload
|
|
54
54
|
report: Option<String>,
|
|
55
|
+
|
|
56
|
+
#[arg(
|
|
57
|
+
long,
|
|
58
|
+
help = "The name of the Corgea project. Defaults to git repository name if found, otherwise to the current directory name."
|
|
59
|
+
)]
|
|
60
|
+
project_name: Option<String>,
|
|
55
61
|
},
|
|
56
62
|
/// Scan the current directory. Supports blast, semgrep and snyk.
|
|
57
63
|
Scan {
|
|
@@ -236,18 +242,18 @@ fn main() {
|
|
|
236
242
|
}
|
|
237
243
|
}
|
|
238
244
|
}
|
|
239
|
-
Some(Commands::Upload { report }) => {
|
|
245
|
+
Some(Commands::Upload { report, project_name }) => {
|
|
240
246
|
verify_token_and_exit_when_fail(&corgea_config);
|
|
241
247
|
match report {
|
|
242
248
|
Some(report) => {
|
|
243
249
|
if report.ends_with(".fpr") {
|
|
244
|
-
fortify_parse(&corgea_config, report);
|
|
250
|
+
fortify_parse(&corgea_config, report, project_name.clone());
|
|
245
251
|
} else {
|
|
246
|
-
scan::read_file_report(&corgea_config, report);
|
|
252
|
+
scan::read_file_report(&corgea_config, report, project_name.clone());
|
|
247
253
|
}
|
|
248
254
|
}
|
|
249
255
|
None => {
|
|
250
|
-
scan::read_stdin_report(&corgea_config);
|
|
256
|
+
scan::read_stdin_report(&corgea_config, project_name.clone());
|
|
251
257
|
}
|
|
252
258
|
}
|
|
253
259
|
}
|
|
@@ -332,8 +338,8 @@ fn main() {
|
|
|
332
338
|
}
|
|
333
339
|
}
|
|
334
340
|
match scanner {
|
|
335
|
-
Scanner::Snyk => scan::run_snyk(&corgea_config),
|
|
336
|
-
Scanner::Semgrep => scan::run_semgrep(&corgea_config),
|
|
341
|
+
Scanner::Snyk => scan::run_snyk(&corgea_config, project_name.clone()),
|
|
342
|
+
Scanner::Semgrep => scan::run_semgrep(&corgea_config, project_name.clone()),
|
|
337
343
|
Scanner::Blast => scanners::blast::run(&corgea_config, fail_on.clone(), fail, only_uncommitted, scan_type.clone(), policy.clone(), out_format.clone(), out_file.clone(), target.clone(), project_name.clone())
|
|
338
344
|
}
|
|
339
345
|
}
|
|
@@ -51,7 +51,7 @@ pub struct ScanUploadResult {
|
|
|
51
51
|
pub project_id: Option<String>,
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
pub fn run_semgrep(config: &Config) {
|
|
54
|
+
pub fn run_semgrep(config: &Config, project_name: Option<String>) {
|
|
55
55
|
println!("Scanning with semgrep...");
|
|
56
56
|
let base_command = "semgrep";
|
|
57
57
|
let mut command = std::process::Command::new(base_command);
|
|
@@ -61,12 +61,12 @@ pub fn run_semgrep(config: &Config) {
|
|
|
61
61
|
|
|
62
62
|
let output = run_command(&base_command.to_string(), command);
|
|
63
63
|
|
|
64
|
-
if let Some(result) = parse_scan(config, output, true) {
|
|
64
|
+
if let Some(result) = parse_scan(config, output, true, project_name) {
|
|
65
65
|
crate::wait::run(config, Some(result.scan_id), result.project_id);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
pub fn run_snyk(config: &Config) {
|
|
69
|
+
pub fn run_snyk(config: &Config, project_name: Option<String>) {
|
|
70
70
|
println!("Scanning with snyk...");
|
|
71
71
|
let base_command = "snyk";
|
|
72
72
|
let mut command = std::process::Command::new(base_command);
|
|
@@ -76,19 +76,19 @@ pub fn run_snyk(config: &Config) {
|
|
|
76
76
|
|
|
77
77
|
let output = run_command(&base_command.to_string(), command);
|
|
78
78
|
|
|
79
|
-
if let Some(result) = parse_scan(config, output, true) {
|
|
79
|
+
if let Some(result) = parse_scan(config, output, true, project_name) {
|
|
80
80
|
crate::wait::run(config, Some(result.scan_id), result.project_id);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
pub fn read_stdin_report(config: &Config) {
|
|
84
|
+
pub fn read_stdin_report(config: &Config, project_name: Option<String>) {
|
|
85
85
|
let mut input = String::new();
|
|
86
86
|
let _ = io::stdin().read_to_string(&mut input);
|
|
87
87
|
|
|
88
|
-
let _ = parse_scan(config, input, false);
|
|
88
|
+
let _ = parse_scan(config, input, false, project_name);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
pub fn read_file_report(config: &Config, file_path: &str) {
|
|
91
|
+
pub fn read_file_report(config: &Config, file_path: &str, project_name: Option<String>) {
|
|
92
92
|
let input = match std::fs::read_to_string(file_path) {
|
|
93
93
|
Ok(input) => input,
|
|
94
94
|
Err(e) => {
|
|
@@ -97,10 +97,10 @@ pub fn read_file_report(config: &Config, file_path: &str) {
|
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
let _ = parse_scan(config, input, false);
|
|
100
|
+
let _ = parse_scan(config, input, false, project_name);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
pub fn parse_scan(config: &Config, input: String, save_to_file: bool) -> Option<ScanUploadResult> {
|
|
103
|
+
pub fn parse_scan(config: &Config, input: String, save_to_file: bool, project_name: Option<String>) -> Option<ScanUploadResult> {
|
|
104
104
|
debug("Parsing the scan report");
|
|
105
105
|
|
|
106
106
|
// Remove BOM (Byte Order Mark) if present
|
|
@@ -115,7 +115,7 @@ pub fn parse_scan(config: &Config, input: String, save_to_file: bool) -> Option<
|
|
|
115
115
|
std::process::exit(0);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
return upload_scan(config, parse_result.paths, parse_result.scanner, cleaned_input.to_string(), save_to_file);
|
|
118
|
+
return upload_scan(config, parse_result.paths, parse_result.scanner, cleaned_input.to_string(), save_to_file, project_name);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
Err(error_message) => {
|
|
@@ -125,7 +125,7 @@ pub fn parse_scan(config: &Config, input: String, save_to_file: bool) -> Option<
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
pub fn upload_scan(config: &Config, paths: Vec<String>, scanner: String, input: String, save_to_file: bool) -> Option<ScanUploadResult> {
|
|
128
|
+
pub fn upload_scan(config: &Config, paths: Vec<String>, scanner: String, input: String, save_to_file: bool, project_name: Option<String>) -> Option<ScanUploadResult> {
|
|
129
129
|
let in_ci = running_in_ci();
|
|
130
130
|
let ci_platform = which_ci();
|
|
131
131
|
let github_env_vars = get_github_env_vars();
|
|
@@ -133,7 +133,6 @@ pub fn upload_scan(config: &Config, paths: Vec<String>, scanner: String, input:
|
|
|
133
133
|
let run_id = Uuid::new_v4().to_string();
|
|
134
134
|
let token = config.get_token();
|
|
135
135
|
let base_url = config.get_url();
|
|
136
|
-
let current_dir = std::env::current_dir().expect("Failed to get current directory");
|
|
137
136
|
let project;
|
|
138
137
|
|
|
139
138
|
if in_ci {
|
|
@@ -142,7 +141,7 @@ pub fn upload_scan(config: &Config, paths: Vec<String>, scanner: String, input:
|
|
|
142
141
|
github_env_vars.get("GITHUB_REPOSITORY").expect("Failed to get GITHUB_REPOSITORY").to_string(),
|
|
143
142
|
github_env_vars.get("GITHUB_PR").expect("Failed to get GITHUB_REPOSITORY").to_string())
|
|
144
143
|
} else {
|
|
145
|
-
project =
|
|
144
|
+
project = utils::generic::determine_project_name(project_name.as_deref());
|
|
146
145
|
}
|
|
147
146
|
let repo_data = std::env::var("REPO_DATA").unwrap_or_else(|_| "".to_string()); //encoded data to forward.
|
|
148
147
|
|
|
@@ -9,7 +9,7 @@ use quick_xml::reader::Reader;
|
|
|
9
9
|
use crate::Config;
|
|
10
10
|
use crate::scan::upload_scan;
|
|
11
11
|
|
|
12
|
-
pub fn parse(config: &Config, file_path: &str) {
|
|
12
|
+
pub fn parse(config: &Config, file_path: &str, project_name: Option<String>) {
|
|
13
13
|
let temp_dir = match TempDir::new() {
|
|
14
14
|
Ok(dir) => dir,
|
|
15
15
|
Err(e) => {
|
|
@@ -48,7 +48,7 @@ pub fn parse(config: &Config, file_path: &str) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
let (scan_data, paths) = extract_file_path(outpath);
|
|
51
|
-
let _scan_id = upload_scan(config, paths, "fortify".to_string(), scan_data, false);
|
|
51
|
+
let _scan_id = upload_scan(config, paths, "fortify".to_string(), scan_data, false, project_name);
|
|
52
52
|
} else {
|
|
53
53
|
println!("File 'audit.fvdl' not found in the archive");
|
|
54
54
|
};
|
|
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
|
|
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
|
|
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
|