Repository navigation
fix: pass image reference to syft sbom source object - #2612
Merged
Merged
Conversation
✅ Deploy Preview for zarf-docs canceled.
|
AustinAbro321
approved these changes
Jun 11, 2024
schristoff-du
approved these changes
Jun 11, 2024
Racer159
referenced
this pull request
in defenseunicorns/maru-runner
Jul 11, 2024
[](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [actions/checkout](https://togithub.com/actions/checkout) | action | patch | `v4.1.6` -> `v4.1.7` | | [actions/create-github-app-token](https://togithub.com/actions/create-github-app-token) | action | patch | `v1.10.1` -> `v1.10.3` | | [actions/download-artifact](https://togithub.com/actions/download-artifact) | action | patch | `v4.1.7` -> `v4.1.8` | | [actions/setup-go](https://togithub.com/actions/setup-go) | action | patch | `v5.0.1` -> `v5.0.2` | | [actions/setup-node](https://togithub.com/actions/setup-node) | action | patch | `v4.0.2` -> `v4.0.3` | | [actions/upload-artifact](https://togithub.com/actions/upload-artifact) | action | patch | `v4.3.3` -> `v4.3.4` | | [anchore/sbom-action](https://togithub.com/anchore/sbom-action) | action | patch | `v0.16.0` -> `v0.16.1` | | [defenseunicorns/zarf](https://togithub.com/defenseunicorns/zarf) | | minor | `v0.34.0` -> `v0.35.0` | | [docker/setup-buildx-action](https://togithub.com/docker/setup-buildx-action) | action | minor | `v3.3.0` -> `v3.4.0` | | [github/codeql-action](https://togithub.com/github/codeql-action) | action | patch | `v3.25.8` -> `v3.25.11` | --- ### Release Notes <details> <summary>actions/checkout (actions/checkout)</summary> ### [`v4.1.7`](https://togithub.com/actions/checkout/blob/HEAD/CHANGELOG.md#v417) [Compare Source](https://togithub.com/actions/checkout/compare/v4.1.6...v4.1.7) - Bump the minor-npm-dependencies group across 1 directory with 4 updates by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/actions/checkout/pull/1739](https://togithub.com/actions/checkout/pull/1739) - Bump actions/checkout from 3 to 4 by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/actions/checkout/pull/1697](https://togithub.com/actions/checkout/pull/1697) - Check out other refs/\* by commit by [@​orhantoy](https://togithub.com/orhantoy) in [https://github.com/actions/checkout/pull/1774](https://togithub.com/actions/checkout/pull/1774) - Pin actions/checkout's own workflows to a known, good, stable version. by [@​jww3](https://togithub.com/jww3) in [https://github.com/actions/checkout/pull/1776](https://togithub.com/actions/checkout/pull/1776) </details> <details> <summary>actions/create-github-app-token (actions/create-github-app-token)</summary> ### [`v1.10.3`](https://togithub.com/actions/create-github-app-token/releases/tag/v1.10.3) [Compare Source](https://togithub.com/actions/create-github-app-token/compare/v1.10.2...v1.10.3) ##### Bug Fixes - **deps:** bump undici from 6.18.2 to 6.19.2 in the production-dependencies group ([#​149](https://togithub.com/actions/create-github-app-token/issues/149)) ([cc82279](https://togithub.com/actions/create-github-app-token/commit/cc82279e84540c5543078cedc5af4fcfab0a96bb)), closes [#​3337](https://togithub.com/actions/create-github-app-token/issues/3337) [nodejs/undici#3338](https://togithub.com/nodejs/undici/issues/3338) [nodejs/undici#3340](https://togithub.com/nodejs/undici/issues/3340) [nodejs/undici#3332](https://togithub.com/nodejs/undici/issues/3332) [nodejs/undici#3335](https://togithub.com/nodejs/undici/issues/3335) [nodejs/undici#3305](https://togithub.com/nodejs/undici/issues/3305) [nodejs/undici#3303](https://togithub.com/nodejs/undici/issues/3303) [nodejs/undici#3304](https://togithub.com/nodejs/undici/issues/3304) [nodejs/undici#3306](https://togithub.com/nodejs/undici/issues/3306) [nodejs/undici#3309](https://togithub.com/nodejs/undici/issues/3309) [nodejs/undici#3313](https://togithub.com/nodejs/undici/issues/3313) [nodejs/undici#3311](https://togithub.com/nodejs/undici/issues/3311) [nodejs/undici#3107](https://togithub.com/nodejs/undici/issues/3107) [nodejs/undici#3302](https://togithub.com/nodejs/undici/issues/3302) [nodejs/undici#3320](https://togithub.com/nodejs/undici/issues/3320) [nodejs/undici#3321](https://togithub.com/nodejs/undici/issues/3321) [nodejs/undici#3316](https://togithub.com/nodejs/undici/issues/3316) [nodejs/undici#3318](https://togithub.com/nodejs/undici/issues/3318) [nodejs/undici#3326](https://togithub.com/nodejs/undici/issues/3326) [nodejs/undici#3324](https://togithub.com/nodejs/undici/issues/3324) [nodejs/undici#3325](https://togithub.com/nodejs/undici/issues/3325) [nodejs/undici#3316](https://togithub.com/nodejs/undici/issues/3316) [nodejs/undici#3318](https://togithub.com/nodejs/undici/issues/3318) [#​3342](https://togithub.com/actions/create-github-app-token/issues/3342) [#​3332](https://togithub.com/actions/create-github-app-token/issues/3332) [#​3340](https://togithub.com/actions/create-github-app-token/issues/3340) [#​3337](https://togithub.com/actions/create-github-app-token/issues/3337) [#​3338](https://togithub.com/actions/create-github-app-token/issues/3338) [#​3336](https://togithub.com/actions/create-github-app-token/issues/3336) [#​3335](https://togithub.com/actions/create-github-app-token/issues/3335) [#​3325](https://togithub.com/actions/create-github-app-token/issues/3325) [#​3324](https://togithub.com/actions/create-github-app-token/issues/3324) [#​3326](https://togithub.com/actions/create-github-app-token/issues/3326) ### [`v1.10.2`](https://togithub.com/actions/create-github-app-token/releases/tag/v1.10.2) [Compare Source](https://togithub.com/actions/create-github-app-token/compare/v1.10.1...v1.10.2) ##### Bug Fixes - do not revoke token if already expired ([#​147](https://togithub.com/actions/create-github-app-token/issues/147)) ([66a7045](https://togithub.com/actions/create-github-app-token/commit/66a70456860bafc79e37635eea77b8b2a929f6c8)), closes [#​140](https://togithub.com/actions/create-github-app-token/issues/140) [#​95](https://togithub.com/actions/create-github-app-token/issues/95) </details> <details> <summary>actions/download-artifact (actions/download-artifact)</summary> ### [`v4.1.8`](https://togithub.com/actions/download-artifact/releases/tag/v4.1.8) [Compare Source](https://togithub.com/actions/download-artifact/compare/v4.1.7...v4.1.8) ##### What's Changed - Update [@​actions/artifact](https://togithub.com/actions/artifact) version, bump dependencies by [@​robherley](https://togithub.com/robherley) in [https://github.com/actions/download-artifact/pull/341](https://togithub.com/actions/download-artifact/pull/341) **Full Changelog**: actions/download-artifact@v4...v4.1.8 </details> <details> <summary>actions/setup-go (actions/setup-go)</summary> ### [`v5.0.2`](https://togithub.com/actions/setup-go/compare/v5.0.1...v5.0.2) [Compare Source](https://togithub.com/actions/setup-go/compare/v5.0.1...v5.0.2) </details> <details> <summary>actions/setup-node (actions/setup-node)</summary> ### [`v4.0.3`](https://togithub.com/actions/setup-node/compare/v4.0.2...v4.0.3) [Compare Source](https://togithub.com/actions/setup-node/compare/v4.0.2...v4.0.3) </details> <details> <summary>actions/upload-artifact (actions/upload-artifact)</summary> ### [`v4.3.4`](https://togithub.com/actions/upload-artifact/releases/tag/v4.3.4) [Compare Source](https://togithub.com/actions/upload-artifact/compare/v4.3.3...v4.3.4) ##### What's Changed - Update [@​actions/artifact](https://togithub.com/actions/artifact) version, bump dependencies by [@​robherley](https://togithub.com/robherley) in [https://github.com/actions/upload-artifact/pull/584](https://togithub.com/actions/upload-artifact/pull/584) **Full Changelog**: actions/upload-artifact@v4.3.3...v4.3.4 </details> <details> <summary>anchore/sbom-action (anchore/sbom-action)</summary> ### [`v0.16.1`](https://togithub.com/anchore/sbom-action/releases/tag/v0.16.1) [Compare Source](https://togithub.com/anchore/sbom-action/compare/v0.16.0...v0.16.1) #### Changes in v0.16.1 - fix: workaround windows install issue ([#​477](https://togithub.com/anchore/sbom-action/issues/477)) \[[willmurphyscode](https://togithub.com/willmurphyscode)] - fix: allow users to properly use the file input over the default path value ([#​471](https://togithub.com/anchore/sbom-action/issues/471)) \[[komish](https://togithub.com/komish)] - chore(deps): update Syft to v1.5.0 ([#​470](https://togithub.com/anchore/sbom-action/issues/470)) \[[anchore-actions-token-generator](https://togithub.com/anchore-actions-token-generator)] - docs: notes for matrix and required permissions ([#​469](https://togithub.com/anchore/sbom-action/issues/469)) \[[kzantow](https://togithub.com/kzantow)] - chore(deps): bump actions/checkout from 4.1.5 to 4.1.6 ([#​466](https://togithub.com/anchore/sbom-action/issues/466)) \[[dependabot](https://togithub.com/dependabot)] </details> <details> <summary>defenseunicorns/zarf (defenseunicorns/zarf)</summary> ### [`v0.35.0`](https://togithub.com/defenseunicorns/zarf/releases/tag/v0.35.0) [Compare Source](https://togithub.com/defenseunicorns/zarf/compare/v0.34.0...v0.35.0) ##### What's Changed - refactor: remove use of k8s info and nodes by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2551](https://togithub.com/defenseunicorns/zarf/pull/2551) - test: shutdown http test servers by [@​lucasrod16](https://togithub.com/lucasrod16) in [https://github.com/defenseunicorns/zarf/pull/2559](https://togithub.com/defenseunicorns/zarf/pull/2559) - feat: adding labels to all resources mutated by the agent by [@​AustinAbro321](https://togithub.com/AustinAbro321) in [https://github.com/defenseunicorns/zarf/pull/2557](https://togithub.com/defenseunicorns/zarf/pull/2557) - test: zarf init state by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2556](https://togithub.com/defenseunicorns/zarf/pull/2556) - refactor: remove use of k8s deprecations by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2560](https://togithub.com/defenseunicorns/zarf/pull/2560) - test: remove validate pkg arch e2e test by [@​lucasrod16](https://togithub.com/lucasrod16) in [https://github.com/defenseunicorns/zarf/pull/2563](https://togithub.com/defenseunicorns/zarf/pull/2563) - test: remove TestMismatchedVersions e2e test by [@​lucasrod16](https://togithub.com/lucasrod16) in [https://github.com/defenseunicorns/zarf/pull/2564](https://togithub.com/defenseunicorns/zarf/pull/2564) - test: delete agent e2e label test by [@​AustinAbro321](https://togithub.com/AustinAbro321) in [https://github.com/defenseunicorns/zarf/pull/2568](https://togithub.com/defenseunicorns/zarf/pull/2568) - fix: add custom error printing for Zarf commands by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2575](https://togithub.com/defenseunicorns/zarf/pull/2575) - refactor: remove use of k8s dynamic by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2561](https://togithub.com/defenseunicorns/zarf/pull/2561) - refactor: remove use of k8s namespace by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2550](https://togithub.com/defenseunicorns/zarf/pull/2550) - fix: cancel Cobra parent context on interrupt by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2567](https://togithub.com/defenseunicorns/zarf/pull/2567) - refactor: use root ctx in agent by [@​AustinAbro321](https://togithub.com/AustinAbro321) in [https://github.com/defenseunicorns/zarf/pull/2578](https://togithub.com/defenseunicorns/zarf/pull/2578) - chore: deprecate DeprecatedKeys by [@​schristoff-du](https://togithub.com/schristoff-du) in [https://github.com/defenseunicorns/zarf/pull/2581](https://togithub.com/defenseunicorns/zarf/pull/2581) - test: validate package by [@​AustinAbro321](https://togithub.com/AustinAbro321) in [https://github.com/defenseunicorns/zarf/pull/2569](https://togithub.com/defenseunicorns/zarf/pull/2569) - chore: fix typos by [@​beholdenkey](https://togithub.com/beholdenkey) in [https://github.com/defenseunicorns/zarf/pull/2590](https://togithub.com/defenseunicorns/zarf/pull/2590) - fix: docker containerd blob error by [@​AustinAbro321](https://togithub.com/AustinAbro321) in [https://github.com/defenseunicorns/zarf/pull/2593](https://togithub.com/defenseunicorns/zarf/pull/2593) - fix(deps): update module github.com/defenseunicorns/pkg/oci to v1 by [@​renovate](https://togithub.com/renovate) in [https://github.com/defenseunicorns/zarf/pull/2511](https://togithub.com/defenseunicorns/zarf/pull/2511) - fix: change so that second SIGINT signal immediately exits program by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2598](https://togithub.com/defenseunicorns/zarf/pull/2598) - refactor: add context in packager by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2597](https://togithub.com/defenseunicorns/zarf/pull/2597) - chore: update go version to 1.22.4 by [@​lucasrod16](https://togithub.com/lucasrod16) in [https://github.com/defenseunicorns/zarf/pull/2595](https://togithub.com/defenseunicorns/zarf/pull/2595) - fix: handle errors in version command by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2589](https://togithub.com/defenseunicorns/zarf/pull/2589) - fix: cosign image pulls by [@​AustinAbro321](https://togithub.com/AustinAbro321) in [https://github.com/defenseunicorns/zarf/pull/2599](https://togithub.com/defenseunicorns/zarf/pull/2599) - refactor: move k8s tunnel to cluster package by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2566](https://togithub.com/defenseunicorns/zarf/pull/2566) - test: cleanup e2e tests by [@​lucasrod16](https://togithub.com/lucasrod16) in [https://github.com/defenseunicorns/zarf/pull/2601](https://togithub.com/defenseunicorns/zarf/pull/2601) - refactor: enable errcheck linter by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2501](https://togithub.com/defenseunicorns/zarf/pull/2501) - fix: crane option argument parameters by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2609](https://togithub.com/defenseunicorns/zarf/pull/2609) - feat: remove .metadata.image from schema by [@​AustinAbro321](https://togithub.com/AustinAbro321) in [https://github.com/defenseunicorns/zarf/pull/2606](https://togithub.com/defenseunicorns/zarf/pull/2606) - refactor: remove use of k8s pods by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2553](https://togithub.com/defenseunicorns/zarf/pull/2553) - fix: pass image reference to syft sbom source object by [@​lucasrod16](https://togithub.com/lucasrod16) in [https://github.com/defenseunicorns/zarf/pull/2612](https://togithub.com/defenseunicorns/zarf/pull/2612) - fix: only build a single binary in the init-package make target by [@​lucasrod16](https://togithub.com/lucasrod16) in [https://github.com/defenseunicorns/zarf/pull/2614](https://togithub.com/defenseunicorns/zarf/pull/2614) - fix: avoid injector pod name collisions by [@​lucasrod16](https://togithub.com/lucasrod16) in [https://github.com/defenseunicorns/zarf/pull/2620](https://togithub.com/defenseunicorns/zarf/pull/2620) - fix: no longer remove the agent ignore label from namespaces by [@​Racer159](https://togithub.com/Racer159) in [https://github.com/defenseunicorns/zarf/pull/2623](https://togithub.com/defenseunicorns/zarf/pull/2623) - refactor: remove use of k8s secret by [@​phillebaba](https://togithub.com/phillebaba) in [https://github.com/defenseunicorns/zarf/pull/2565](https://togithub.com/defenseunicorns/zarf/pull/2565) - fix: using a new s3 backend for test data by [@​AustinAbro321](https://togithub.com/AustinAbro321) in [https://github.com/defenseunicorns/zarf/pull/2630](https://togithub.com/defenseunicorns/zarf/pull/2630) - chore(deps): update goreleaser/goreleaser-action action to v6 by [@​renovate](https://togithub.com/renovate) in [https://github.com/defenseunicorns/zarf/pull/2596](https://togithub.com/defenseunicorns/zarf/pull/2596) **Full Changelog**: zarf-dev/zarf@v0.34.0...v0.35.0 </details> <details> <summary>docker/setup-buildx-action (docker/setup-buildx-action)</summary> ### [`v3.4.0`](https://togithub.com/docker/setup-buildx-action/releases/tag/v3.4.0) [Compare Source](https://togithub.com/docker/setup-buildx-action/compare/v3.3.0...v3.4.0) - Throw error message instead of exit code by [@​crazy-max](https://togithub.com/crazy-max) in [https://github.com/docker/setup-buildx-action/pull/315](https://togithub.com/docker/setup-buildx-action/pull/315) - Bump [@​docker/actions-toolkit](https://togithub.com/docker/actions-toolkit) from 0.20.0 to 0.31.0 in [https://github.com/docker/setup-buildx-action/pull/321](https://togithub.com/docker/setup-buildx-action/pull/321) [https://github.com/docker/setup-buildx-action/pull/338](https://togithub.com/docker/setup-buildx-action/pull/338) - Bump braces from 3.0.2 to 3.0.3 in [https://github.com/docker/setup-buildx-action/pull/329](https://togithub.com/docker/setup-buildx-action/pull/329) - Bump undici from 5.28.3 to 5.28.4 in [https://github.com/docker/setup-buildx-action/pull/312](https://togithub.com/docker/setup-buildx-action/pull/312) - Bump uuid from 9.0.1 to 10.0.0 in [https://github.com/docker/setup-buildx-action/pull/326](https://togithub.com/docker/setup-buildx-action/pull/326) **Full Changelog**: docker/setup-buildx-action@v3.3.0...v3.4.0 </details> <details> <summary>github/codeql-action (github/codeql-action)</summary> ### [`v3.25.11`](https://togithub.com/github/codeql-action/compare/v3.25.10...v3.25.11) [Compare Source](https://togithub.com/github/codeql-action/compare/v3.25.10...v3.25.11) ### [`v3.25.10`](https://togithub.com/github/codeql-action/compare/v3.25.9...v3.25.10) [Compare Source](https://togithub.com/github/codeql-action/compare/v3.25.9...v3.25.10) ### [`v3.25.9`](https://togithub.com/github/codeql-action/compare/v3.25.8...v3.25.9) [Compare Source](https://togithub.com/github/codeql-action/compare/v3.25.8...v3.25.9) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 12pm every weekday,before 11am every weekday" in timezone America/New_York, Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/defenseunicorns/maru-runner). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjQyNS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJzdXBwb3J0LWRlcHMiXX0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Wayne Starr <Racer159@users.noreply.github.com>
AustinAbro321
pushed a commit
that referenced
this pull request
Jul 23, 2024
## Description
When creating an image SBOM with syft, we currently pass an empty string
`""` to `NewFromStereoscopeImageObject` when creating a new image source
object.
```go
source.NewFromStereoscopeImageObject(syftImage, "", nil)
```
The second argument is the image reference. This data is ultimately used
to populate the source metadata in the final SBOM, but since we pass an
empty string, the `userInput` field is empty.
The fix is to pass in the image reference so that the `userInput` field
is populated in the final SBOM.
```go
source.NewFromStereoscopeImageObject(syftImage, ref, nil)
```
Steps to reproduce:
1. Create this package
```yaml
kind: ZarfPackageConfig
metadata:
name: sbom-test
architecture: amd64
components:
- name: sbom-test
required: true
images:
- quay.io/minio/minio:RELEASE.2024-03-21T23-13-43Z
```
1. Extract the package
```shell
zarf tools archiver decompress zarf-package-sbom-test-amd64.tar.zst sbom
```
1. Extract the sbom tarball
```shell
zarf tools archiver decompress sbom/sboms.tar sbom/syft
```
1. Check the `.source.metadata.userInput` field in the image SBOM
```shell
cat sbom/syft/quay.io_minio_minio_RELEASE.2024-03-21T23-13-43Z.json | jq
.source.metadata.userInput
```
With current Zarf, you will see that it returns an empty string. Re-run
all of the above steps with Zarf built from this PR branch, and you will
see it returns the image reference
`quay.io/minio/minio:RELEASE.2024-03-21T23-13-43Z`
1. Generate a vulnerability scan report with `grype`
```shell
cat sbom/syft/quay.io_minio_minio_RELEASE.2024-03-21T23-13-43Z.json |
grype -o sarif > zarf-scan.json
```
You will see that the generated report is missing the image reference in
the output
`"text": "A medium vulnerability in go-module package:
gopkg.in/square/go-jose.v2, version v2.6.0 was found in image at:
/usr/bin/minio"`
Re-run all of the above steps with Zarf built from this PR branch, and
you will see the image reference in the generated report:
`"text": "A medium vulnerability in go-module package:
gopkg.in/square/go-jose.v2, version v2.6.0 was found in image
quay.io/minio/minio:RELEASE.2024-03-21T23-13-43Z at: /usr/bin/minio"`
## Related Issue
Fixes #2608
## Checklist before merging
- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When creating an image SBOM with syft, we currently pass an empty string
""toNewFromStereoscopeImageObjectwhen creating a new image source object.The second argument is the image reference. This data is ultimately used to populate the source metadata in the final SBOM, but since we pass an empty string, the
userInputfield is empty.The fix is to pass in the image reference so that the
userInputfield is populated in the final SBOM.Steps to reproduce:
Create this package
Extract the package
Extract the sbom tarball
Check the
.source.metadata.userInputfield in the image SBOMcat sbom/syft/quay.io_minio_minio_RELEASE.2024-03-21T23-13-43Z.json | jq .source.metadata.userInputWith current Zarf, you will see that it returns an empty string. Re-run all of the above steps with Zarf built from this PR branch, and you will see it returns the image reference
quay.io/minio/minio:RELEASE.2024-03-21T23-13-43ZGenerate a vulnerability scan report with
grypeYou will see that the generated report is missing the image reference in the output
"text": "A medium vulnerability in go-module package: gopkg.in/square/go-jose.v2, version v2.6.0 was found in image at: /usr/bin/minio"Re-run all of the above steps with Zarf built from this PR branch, and you will see the image reference in the generated report:
"text": "A medium vulnerability in go-module package: gopkg.in/square/go-jose.v2, version v2.6.0 was found in image quay.io/minio/minio:RELEASE.2024-03-21T23-13-43Z at: /usr/bin/minio"Related Issue
Fixes #2608
Checklist before merging