Skip to content

Commit 0e4fce2

Browse files
committed
ci(osv-scanner): fix arguments too long
1 parent ea57bdb commit 0e4fce2

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

.github/workflows/osv-scanner-pr.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,19 @@ jobs:
4040
run: |
4141
set -euo pipefail
4242
IFS=$'\n\t'
43+
cat > "${RUNNER_TEMP}/new_results.json" <<'__OSV_NEW_RESULTS_EOF__'
44+
${{ needs.osv-scanner-pr.outputs.new-results }}
45+
__OSV_NEW_RESULTS_EOF__
46+
cat > "${RUNNER_TEMP}/old_results.json" <<'__OSV_OLD_RESULTS_EOF__'
47+
${{ needs.osv-scanner-pr.outputs.old-results }}
48+
__OSV_OLD_RESULTS_EOF__
4349
rc=0
44-
echo "${NEW_RESULTS}" | jq -r '.results[].packages[].vulnerabilities[].id' | while read -r vid; do
45-
if echo "${OLD_RESULTS}" | grep -q -L -e "\"${vid}\""; then
50+
jq -r '.results[].packages[].vulnerabilities[].id' "${RUNNER_TEMP}/new_results.json" | while read -r vid; do
51+
if grep -q -L -e "\"${vid}\"" "${RUNNER_TEMP}/old_results.json"; then
4652
rc=$((rc+1))
4753
>&2 echo "error: PR introduces new vulnerabilities ${vid} (see step 'scan > osv-scanner-pr > Run osv-scanner-reporter' for details)"
4854
fi
4955
done
5056
if [ "${rc}" -gt 0 ]; then
5157
exit "${rc}"
5258
fi
53-
env:
54-
OLD_RESULTS: ${{ needs.osv-scanner-pr.outputs.old-results }}
55-
NEW_RESULTS: ${{ needs.osv-scanner-pr.outputs.new-results }}

.github/workflows/osv-scanner.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,21 @@ jobs:
4242
run: |
4343
set -euo pipefail
4444
IFS=$'\n\t'
45+
cat > "${RUNNER_TEMP}/results.json" <<'__OSV_RESULTS_EOF__'
46+
${{ needs.osv-scanner.outputs.results }}
47+
__OSV_RESULTS_EOF__
4548
# jq expression:
4649
# - iterate packages -> vulnerabilities -> full osv entry -> severity[] (type, score)
4750
# - extract numeric scores for CVSS types (cvss_v3 or numeric severity[].score)
4851
# - compare to threshold
49-
if echo "${RESULTS}" | jq '
52+
if jq '
5053
.results[]
5154
| .packages[]?
5255
| .vulnerabilities[]?
5356
| ( .severity[]?.score // "" ) as $s
5457
| select($s != "")
5558
| ($s | tonumber) >= 4.0
56-
' | grep -q -e . ; then
59+
' "${RUNNER_TEMP}/results.json" | grep -q -e . ; then
5760
>&2 echo "error: found one or more vulnerabilities with a medium or higher severity (see step 'scan > osv-scanner > Run osv-scanner-reporter' for details)"
5861
exit 1
5962
fi
60-
env:
61-
RESULTS: ${{ needs.osv-scanner.outputs.results }}

.zizmor.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,7 @@ rules:
1515
- ossf/*
1616
- sigstore/*
1717
- super-linter/super-linter
18+
template-injection:
19+
ignore:
20+
- osv-scanner.yml
21+
- osv-scanner-pr.yml

0 commit comments

Comments
 (0)