Skip to content

Commit 683d1d8

Browse files
committed
ci: distinguish advisories from findings in the scan report
The first CI run reported "14 unignored advisories" while the scan had found 13. The scan was right and the message was wrong. One advisory can affect several module versions in the same bundle, because different binaries pin different versions -- GO-2026-5970 is present at both golang.org/x/text@0.37.0 and @0.38.0. The count was over rows, one per (advisory, module@version) pair, and every row was being called an advisory. Counts both now: advisories for the headline, findings for the per-module rows, both in the error and the step summary. The gate condition is unchanged. Signed-off-by: Mauro Morales <contact@mauromorales.com>
1 parent 8e6c737 commit 683d1d8

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

.github/workflows/release-scan.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,28 +123,35 @@ jobs:
123123
- name: Report and enforce
124124
run: |
125125
set -euo pipefail
126+
# One advisory can affect several module versions in the same bundle
127+
# (different binaries pin different versions), so a finding is an
128+
# (advisory, module@version) pair and the two counts differ. Report
129+
# both rather than calling every row an advisory.
126130
jq -r '
127131
[ .results[].packages[]
128132
| . as $pkg
129133
| .vulnerabilities[]?
130134
| "| `\(.id)` | `\($pkg.package.name)@\($pkg.package.version)` |"
131135
] | unique | .[]' osv.json > findings.md || true
132-
COUNT="$(wc -l < findings.md)"
136+
FINDINGS="$(wc -l < findings.md)"
137+
ADVISORIES="$(jq -r '[.results[].packages[].vulnerabilities[]?.id] | unique | length' osv.json)"
133138
{
134139
echo "## Vulnerability scan of the shipped bundle"
135140
echo
136141
echo "kairos-init \`${{ steps.pin.outputs.version }}\`, scanned uncompressed."
137142
echo
138-
if [ "${COUNT}" -eq 0 ]; then
143+
if [ "${FINDINGS}" -eq 0 ]; then
139144
echo "No unignored advisories."
140145
else
146+
echo "**${ADVISORIES} advisories**, ${FINDINGS} findings across module versions."
147+
echo
141148
echo "| advisory | module |"
142149
echo "|---|---|"
143150
cat findings.md
144151
fi
145152
} >> "${GITHUB_STEP_SUMMARY}"
146-
if [ "${COUNT}" -gt 0 ]; then
147-
echo "::error::${COUNT} unignored advisories in the shipped bundle. Bump the affected component, or add a dated entry to osv-scanner.toml with a reason."
153+
if [ "${FINDINGS}" -gt 0 ]; then
154+
echo "::error::${ADVISORIES} unignored advisories (${FINDINGS} findings) in the shipped bundle. Bump the affected component, or add a dated entry to osv-scanner.toml with a reason."
148155
exit 1
149156
fi
150157

0 commit comments

Comments
 (0)