Skip to content

Commit a0f119c

Browse files
committed
fixed key val issue
1 parent f5b3125 commit a0f119c

File tree

3 files changed

+35
-17
lines changed

3 files changed

+35
-17
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
context: .
2929
file: ./Dockerfile
3030
push: true
31-
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hela:v3
31+
tags: ${{ secrets.DOCKERHUB_USERNAME }}/hela:v4

src/utils/pipeline.rs

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -145,31 +145,49 @@ pub async fn pipeline_failure(
145145
HashMap::new();
146146

147147
for result in sast_results {
148-
let summary_without_commit = result["summary"]
149-
.clone()
150-
.to_string()
151-
.split("\n\nCommit:")
152-
.collect::<Vec<&str>>()[0]
153-
.to_string();
148+
let summary_without_commit = result
149+
.get("summary")
150+
.and_then(|s| Some(s.as_str()))
151+
.map(|s| s.split("\n\nCommit:").collect::<Vec<&str>>()[0].to_string())
152+
.unwrap_or_else(|| "No summary available".to_string());
153+
154+
let package_version = match (result.get("package"), result.get("version")) {
155+
(Some(package), Some(version)) => format!("{}@{}", package, version),
156+
_ => "Unknown package@version".to_string(),
157+
};
158+
159+
let severity = result
160+
.get("severity")
161+
.cloned()
162+
.unwrap_or_else(|| "Unknown severity".into());
163+
let cwe_id = result
164+
.get("cwe_id")
165+
.cloned()
166+
.unwrap_or_else(|| "Unknown CWE ID".into());
167+
let aliases = result
168+
.get("aliases")
169+
.cloned()
170+
.unwrap_or_else(|| "No aliases".into());
171+
154172
let vuln_record = format!(
155173
"\n\nPackage: {}\nSeverity: {}\nSummary: {}\nCWE ID: {}\nAliases: {}",
156-
format!("{}@{}", result["package"], result["version"]),
157-
result["severity"],
158-
summary_without_commit,
159-
result["cwe_id"],
160-
result["aliases"]
174+
package_version, severity, summary_without_commit, cwe_id, aliases
161175
);
176+
162177
let hashed_message = common::hash_text(&vuln_record);
163178

164179
// Collect messages and their hashes along with other details
165180
message_to_hash.insert(
166181
hashed_message,
167182
(
168-
format!("{}@{}", result["package"], result["version"]),
169-
result["severity"].clone(),
170-
result["summary"].clone(),
171-
result["cwe_id"].clone(),
172-
result["aliases"].clone(),
183+
package_version,
184+
severity,
185+
result
186+
.get("summary")
187+
.cloned()
188+
.unwrap_or_else(|| "No summary available".into()),
189+
cwe_id,
190+
aliases,
173191
),
174192
);
175193
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy