-
Notifications
You must be signed in to change notification settings - Fork 5
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
Stop using go list
#32
Comments
Recent false positive https://issues.redhat.com/browse/OADP-2990 |
@kaovilai Thanks for raising an issue, but I admit I'm a bit confused by this one. The In the jira link you've provided for the false positive, it's not clear to me how it was determined However, out of curiosity I tried running
To compare, I ran the two different methods
I'm sorry if I I've misunderstood somehow. Please let me know if I've missed something. |
Ok I have no idea which tool was used. But something outside my team's control is reporting this false positive and in the past it was mentioned that deplist was the culprit. |
Go list -deps still produce less results than go mod parsing would.
Here's a shorter breakdown.
Notice go list is missing dependencies. Reference commit to checkout weshayutin/openshift-velero-plugin@e7586a7 |
go list remains an inaccurate way to determine build dependency. |
|
clearly cloud.google.com/go/storage is a dependency here and would be one of the folders that shows up and required to build when you run Deplist would be missing this. |
Hmm, that is interesting. As best I can tell there seems to be a blind spot here if blank identifiers are used in imports, e.g. Not quite sure yet if this is desirable or not, in the context of inspecting source repos for vulnerable packages. |
I guess it depends on the repo. In this case importing these with blank identifiers still cause init functions Definitely included in the build |
Ah, I think I mis-diagnosed above, the issue actually seems to be that
IIRC this was a vaguely known limitation during prototyping, but considered a justifiable tradeoff on balance. It would be good to address this identifying the correct build flags from the source repo, but I'm not aware of any easy way to do that. If you have suggestions I'm open to it but bear in mind this tool's only known usage is within a legacy tool that is being replaced by https://github.com/RedHatProductSecurity/component-registry. Component Registry (corgi) relies on syft for Go module/package identification, not deplist, so any changes here wouldn't affect the new replacement tool, corgi. |
dependabot.yml or similar perhaps. Repo owner can configure this according to their build. |
My preference would still be to stop using go list or anything relying on buildtags. Implementation example https://github.com/snyk/snyk-go-plugin/blob/master/gosrc/resolve-deps.go#L38 Or you know, parse go.mod. |
duly noted. guess I'll have to hunt down other tools the alert team is using. |
By this, do you mean only identifying modules and not identify used packages at all? I.e. prefer coarse grained, over fine grained? I think only comparing at the module level would lead to much larger number of CVE detections. Package level comparison often allows us to filter out large numbers of what would otherwise be false positives. |
Ok if you're doing package level already then perhaps walking each go files would be the right improvement. |
Per email and recent discoveries. I believe deplist to be in good order. deplist/internal/scan/golang.go Lines 57 to 61 in 44d9278
Closing. |
Current go list command is inaccurate dep and lead to many false positives.
reference
emphasis mine.
Sources:
dependabot/dependabot-core#4740 (comment)
https://github.com/anchore/syft do not inherit this behavior and is preferable that we move to it.
Please remove usage of
go list
from this repo.The text was updated successfully, but these errors were encountered: