Skip to content

Commit 6ca1398

Browse files
majaberejberejmaj
andauthored
Feature/grype (#75)
* purl processing exception fix * purl processing exception fix --------- Co-authored-by: berejmaj <maja.berej@orange.com>
1 parent 0ed53b7 commit 6ca1398

File tree

1 file changed

+14
-2
lines changed
  • backend/src/main/java/io/mixeway/mixewayflowapi/integrations/scanner/sca/service

1 file changed

+14
-2
lines changed

backend/src/main/java/io/mixeway/mixewayflowapi/integrations/scanner/sca/service/SCAGrypeService.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,13 @@ public void processSBOMComponents(File sbomFile, CodeRepo codeRepo) throws IOExc
190190

191191
if (d.getRef() != null && !componentsByPurl.containsKey(d.getRef())) {
192192

193-
PackageURL pkg = new PackageURL(d.getRef());
193+
PackageURL pkg;
194+
try {
195+
pkg = new PackageURL(d.getRef());
196+
} catch (MalformedPackageURLException e) {
197+
log.warn("[GrypeService] Skipping invalid dependency purl: {}", d.getRef(), e);
198+
continue;
199+
}
194200

195201
String type = pkg.getType();
196202
String version = pkg.getVersion();
@@ -216,7 +222,13 @@ public void processSBOMComponents(File sbomFile, CodeRepo codeRepo) throws IOExc
216222
continue;
217223
}
218224

219-
PackageURL pkg = new PackageURL(depPurl);
225+
PackageURL pkg;
226+
try {
227+
pkg = new PackageURL(depPurl);
228+
} catch (MalformedPackageURLException e) {
229+
log.warn("[GrypeService] Skipping invalid dependency purl: {}", depPurl, e);
230+
continue;
231+
}
220232

221233
String type = pkg.getType();
222234
String version = pkg.getVersion();

0 commit comments

Comments
 (0)