Skip to content

Commit 7b90d29

Browse files
authored
fix(ci/cve-scanning): ignore malformed packages (#1699)
Otherwise trivy fails the whole job <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - Bug Fixes - Improved license compliance reports by filtering out malformed packages from the software bill of materials before scanning, reducing noise and false positives. - Maintains existing scan flow and results formatting without changing behavior for successful runs. - Chores - Updated CI processing to enhance accuracy of license scanning with no impact on application functionality or user workflows. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent b36fc6c commit 7b90d29

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

.github/scripts/scan-for-licenses.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ function generateTrivyJson() {
7272
trap 'rm -f "$tmpFile"' RETURN
7373

7474
syft "$image" -o spdx-json >"$tmpFile"
75+
# ignore packages that are not fully defined, otherwise trivy fails
76+
jq -r '.packages |= map(select(.name | endswith("/") | not))' "$tmpFile" | sponge "$tmpFile"
7577
trivy sbom "$tmpFile" --skip-{java-,}db-update --severity HIGH,CRITICAL,MEDIUM -f json --scanners license --quiet | jq -r --arg image "$image" '.Metadata.image = $image'
7678
}
7779
export -f generateTrivyJson

0 commit comments

Comments
 (0)