Repository navigation
fix: scan one image tag in the SBOM step - #684
Conversation
anchore/scan-action v7 passes its image input to grype as is, and on main the metadata tags output is two lines (:main and :latest), so grype could not parse it and every main build since #651 failed after pushing the image. Scan the first tag, as v3 did.
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the change that passes a single Docker image reference to the SBOM scan.
No open issues 🎉
What changed in this PR
Fixes the Docker build’s SBOM scan failure introduced after the scan-action upgrade in #651 by passing a single image reference instead of a newline-separated tag list.
Changes:
- Selects the first tag from Docker metadata JSON for scanning.
- Adds a comment explaining why the full tag list cannot be passed to Grype.
| File | Description |
|---|---|
.github/workflows/dotnet.yml |
Updates the SBOM scan input to use one image tag for main and release builds. |
Review effort: Balanced
There was a problem hiding this comment.
🔒 Automated security review — no issues found
CI-only change: the SBOM scan now passes a single image reference (first tag from docker/metadata-action's JSON output) instead of the newline-separated tag list, fixing a grype parse failure. The tag values come from docker/metadata-action based on branch/tag refs and are passed as an action input, not concatenated into a shell command, so there is no injection surface. All tags for a push refer to the same built image digest, so scanning only the first tag loses no coverage. No exploitable defect found.
Reviewed 1 file at a2f0e82. Nothing to report.
Not a guarantee — one diff, no knowledge of your threat model.
🤖 Automated security review. It never pushes, approves or blocks; a suggestion applies only when you click Commit suggestion.
Every push to main since #651 has failed in the Scan SBOM step, after the image was already pushed. The step passes
steps.meta.outputs.tagsto anchore/scan-action, and on main that output is two lines,:mainand:latest. scan-action v3.6.4 ended up scanning only:main; v7.4.2 hands the whole string to grype, which cannot parse it ("failed to parse reference ...:main\n...:latest"). It failed on #681's merge and on both attempts of #683's.This scans the first tag from the metadata JSON instead, which is what v3 did. Release tags produce three tags, so the next release would have hit the same failure.
The PR's own CI can't show the fix: the scan only runs in docker-build, on a push to main or a tag. The merge of this PR is the test, and it should also leave ghcr.io/lunar-rails/nodeguard:main with a green build.