anchore / grype

A vulnerability scanner for container images and filesystems
Apache License 2.0
8.17k stars 528 forks source link

fix: uppercased package in json #1900

Closed kzantow closed 1 month ago

kzantow commented 1 month ago

A missing JSON tag resulted in an uppercased Package key being output incorectly; this PR corrects the issue.

Fixes #1877

spiffcs commented 1 month ago

🟢 @kzantow nice find on this one instance!

Given that below searchedBy is interface{} are there any other structs that are used here that are missing json tags?

https://github.com/anchore/grype/blob/316c0e9a1105cf2b5ae912d6cc0e29018511a579/grype/presenter/models/match.go#L21-L26

kzantow commented 1 month ago

I searched around for searchedby and package and this was the only one I could find that needed a tag. Most of the searchedby entries are map[string]any like here and here. And this fixes all the uppercase entries in the image referenced in the ticket, e.g.:

            "package": {
              "name": "busybox",
              "version": "1.36.1-r5"
            }