-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/vuln/cmd/govulncheck: CVEs are not detected in GOPATH mode #53741
Comments
I get the following message with the latest govulncheck version:
I get this error everywhere except when I am in the cvetest directory. Could you confirm you get the same or something different? |
@zpavlinovic No, I continue to get the same output as before with the latest version (v0.0.0-20221007155627-b5628b3a3e55). In $GOPATH:
In $GOPATH/src/cvetest:
|
What do you get when you run |
@zpavlinovic It gives the same output.
|
Hm, really unexpected. What happens if you try to govulncheck some different packages, say "nonexistent" that should not exist and similar? Sorry for going back and forth with this, but I cannot reproduce the issue so I am trying to gather as much information as possible. |
A non-existent package yields this output:
Strangely, even though that implies that it first searches for the go.mod file, if I remove the go.mod file from $GOPATH/src/cvetest, it still gives me the wrong output no matter which directory I run it from.
|
@zpavlinovic I think I figured out the issue. Somehow govulncheck is sensitive to the presence of the $GOPATH/src/cvetest/vendor folder (created via
This output is particularly confusing because there is a go.mod file. |
Change https://go.dev/cl/443455 mentions this issue: |
Thanks, that helps. I believe govulncheck is behaving correctly (at least it is consistent with golang.org/x/tools/go/packages/gopackages command), but we'll try to improve error messaging for As the documentation states, govulncheck is always expected to be executed from the module directory. When in When in When the dependencies are not vendored, then the module system needs to be consulted to load dependencies appropriately (as |
Follows https://go-review.git.corp.google.com/c/vuln/+/395241 Fixes golang/go#53741 Change-Id: I9d751cd40530fd31c1d86c26dd4f718681b7719c Reviewed-on: https://go-review.googlesource.com/c/vuln/+/443455 Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Follows https://go-review.git.corp.google.com/c/vuln/+/395241 Fixes golang/go#53741 Change-Id: I9d751cd40530fd31c1d86c26dd4f718681b7719c Reviewed-on: https://go-review.googlesource.com/c/vuln/+/443455 Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Follows https://go-review.git.corp.google.com/c/vuln/+/395241 Fixes golang/go#53741 Change-Id: I9d751cd40530fd31c1d86c26dd4f718681b7719c Reviewed-on: https://go-review.googlesource.com/c/vuln/+/443455 Run-TryBot: Zvonimir Pavlinovic <zpavlinovic@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Reopening #51591 because the issue is still present.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go.mod
main.go
These files are located under $GOPATH/src/cvetest.
I then ran
govulncheck cvetest
in $GOPATH.What did you expect to see?
Either it should report the vulnerability, or at least it should fail with an appropriate error message if this mode of operation is not supported.
What did you see instead?
If I run the same command in $GOPATH/src/cvetest then it works.
The text was updated successfully, but these errors were encountered: