Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: uppercased package in json #1900

Merged
merged 1 commit into from
May 30, 2024

Conversation

kzantow
Copy link
Contributor

@kzantow kzantow commented May 30, 2024

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

Fixes #1877

@spiffcs
Copy link
Contributor

spiffcs commented May 30, 2024

🟢
@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?

type MatchDetails struct {
Type string `json:"type"`
Matcher string `json:"matcher"`
SearchedBy interface{} `json:"searchedBy"` // The specific attributes that were used to search (other than package name and version) --this indicates "how" the match was made.
Found interface{} `json:"found"` // The specific attributes on the vulnerability object that were matched with --this indicates "what" was matched on / within.
}

@kzantow
Copy link
Contributor Author

kzantow commented May 30, 2024

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"
            }

@kzantow kzantow merged commit 31b0fcd into anchore:main May 30, 2024
10 checks passed
@kzantow kzantow deleted the fix/uppercase-json-package branch May 30, 2024 21:37
pouyan021 pushed a commit to pouyan021/grype that referenced this pull request Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent naming of matchDetails.searchedBy.package field
2 participants