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
Fails to parse go stdlib version when experiments are set #1851
Comments
Hi @jonjohnsonjr, thanks for the report! It looks like today we take that field as-is but we need to probably parse out the flags after the X:. We might need to find a place to record those flags somewhere. We'll put this in the backlog for a fix. Let us know if you're interested in working on it and we can help get you started. |
Just adding an explicit note that this causes false negatives, too. The Go stdlib usually accounts for a large surface area in vuln-matching a Go binary, so situations where Grype doesn't take the stdlib into account would mean missing any number of vulns if Go experiments are used. Also IIUC there are worlds where using Go experiments is much more common, such as to support FIPS. |
I can take a stab at it if you can point me in the approximate direction 🙏 |
Hi @jonjohnsonjr, thanks for offering to help with this! The code changes to make are really in Syft. Essentially, Syft should make 2 changes:
The definition of the Go package metadata is here: https://github.com/anchore/syft/blob/6107e5e2ad6e60f3f74ff4d3b2ca2ccffbed26ed/syft/pkg/golang.go#L4 - this definition likely needs new fields to hold information about the experiments, and then they need to be populated. The function that scans the go binary for build info and other information is here: https://github.com/anchore/syft/blob/3023a5a7bc870f70a3dd24213d795516288ca0df/syft/pkg/cataloger/golang/scan_binary.go#L22 - I'm not certain exactly the right factoring for where we should trim the version info and capture the metadata, but this function is in the neighborhood. Happy to discuss further! Please let me know if you have any questions. |
Opened a PR in syft: anchore/syft#2893 I'm honestly not sure how necessary it is given that |
What happened:
What you expected to happen:
Not see this warning:
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
This seems to be not well documented, but I found a reference to it here: https://cs.opensource.google/go/go/+/master:src/runtime/extern.go;l=340-348?q=%22X:%22%20experiment%20list&ss=go%2Fgo:src%2F
Environment:
grype version
:(I am running at HEAD.)
cat /etc/os-release
or similar):MacOS 14.4.1
The text was updated successfully, but these errors were encountered: