ci(grype): install pinned grype by checksum, drop scan-action - #298
Conversation
anchore/scan-action, though pinned by SHA, downloads and executes install.sh from anchore/grype@main at every run, a moving ref the pin does not cover. Install the pinned grype release directly instead and verify it against a sha256 committed in the workflow, then scan with the same severity gate as before (fail on fixable high+). Also disable grype's phone-home update check, which the removed action used to turn off. Redoes #294 by @stephrobert with the review suggestion applied, since the original branch could not be updated. Co-authored-by: Stéphane ROBERT <robert.stephane.28@gmail.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PR SummaryLow Risk Overview The scan step sets Reviewed by Cursor Bugbot for commit 38fd6f0. Bugbot is set up for automated code reviews on this repo. Configure here. |
Supersedes #294 by @stephrobert, recreated because the original fork branch has "Allow edits by maintainers" disabled and the author is currently unreachable, so the pending review suggestion could not be applied there. His change is included verbatim (credited as co-author on the commit) plus the one addition from the review.
Problem
anchore/scan-action, though pinned by SHA, downloads and executesinstall.shfromanchore/grype@mainat every run. That moving ref is not covered by the pin, so the code actually executed in CI could change with no change to this repo.Fix (from #294)
Install the pinned grype release directly and verify it against a sha256 committed in this workflow, then run the scan with the same severity gate as before (
--fail-on high --only-fixed, matching the action'sfail-build: true+severity-cutoff: high+only-fixed: true).To bump grype: update
GRYPE_VERSIONandGRYPE_SHA256together (the hash is published in the release'schecksums.txt; verifying that file withcosign verify-blobat bump time is a good habit).Added on top of #294
GRYPE_CHECK_FOR_APP_UPDATE: "false"on the scan step. The removed action set this; without it grype makes a phone-home update check on every scan.Verification
The pinned sha256 was verified independently: a fresh download of the official
grype_0.114.0_linux_amd64.tar.gzrelease asset hashes to the committed value, matching the release'schecksums.txt. The full chain (checksum OK,grype version, scan completing with the gate applied) already ran green on #294's CI.🤖 Generated with Claude Code