-
Notifications
You must be signed in to change notification settings - Fork 76
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
False positives when dependency versioning isn't go semver #205
Comments
This is wild! Thanks for reporting it. Our service works on these types of versions, but being this is a mixed case it will be interesting to figure out how to solve it. I'll forward to a few people and see what we can do. For now, you could add this vuln to a |
I think my suggestion at current time is to use the tag itself as a version, and not the commit hash. I think you should be able to do:
This should be fine because your |
Thanks a lot! Yeah we simply added a When trying to replace using the tag, Using the base path:
Using a
And replacing an
|
If you run The golang ecosystem has gotten a lot better but this stuff is definitely a fun lil headache :) I tagged a few Sona-friends internally, I'll see if I can gather any information. |
I guess it's the same issue which makes
Running They recommend using the commit hash directly:
which updates the require to
but which has the same |
I think that a) they need to figure out how to get it working properly (seems kinda wacky to not allow someone to get stuff via the actual tag) but I b) know that sometimes that will never happen, :) I tried running everything locally to see what happens, and I think go mod is getting confused because there are old incompatible versions, and so on and so forth. I'll see what we can figure out. The service that does lookup for this type of stuff is likely a bit confused encountering a hash where it expects a semver version range (it's smart but not WICKED smart :) ) |
Totally agreed -- the root issue is clearly not with Thanks for looking into it, I'll watch this space 🤞 |
So we looked at this a lil bit, what is happening is since there is a version that exists with a vulnerability, and the range is unbounded (all versions affected prior to this one), it's returning the vuln as a result of that. In THEORY what we could do is:
It's hard to say if that would be a wonderful solution, because the hashes COULD be between some semver range, it would just be next to impossible to tell. The way we treat these golang vulns with the timestamps is we look between dates to figure out what works. |
I'm not sure I understand the current internals enough, so this might be way off: Two thoughts:
then you compare the timestamps to guess that If that's correct, and the second method doesn't work (which I can understand it might not a lot of the time), then I guess my only suggestion would be to check for other version tags on the commit. |
First of all, thanks for all your work maintaining
nancy
. We're using it in a CI pipeline on this repo, and have recently hit a snag which I think might affect others eventually.We require
github.com/prometheus/prometheus
which for some reason does not adhere to go semver. This also affects others who import it.Our solution is to require the version we want and then replace it with the SHA version, for example:
In this case,
v0.0.0-20201126101154-26d89b4b0776
is the SHA version for the tagv2.23.0
.However, using this method,
nancy
still reports a vulnerability which was present in versions< 2.7.1
. It would be great ifnancy
was able to determine the "actual" version.I made a minimal working example at https://github.com/stone-z/nancy-test.
This false positive means we simply have to exclude a CVE, but I suspect that this situation might arise with other repositories and result in
nancy
yielding incorrect results.Admittedly, since
prometheus
breaks the rules I'm not sure what the best solution is here, or if it makes sense to implement. However, as not every repository uses proper go semver for versioning, it would be great if there was some awareness of tag versions in these circumstances in order to reduce the false positives.If it helps, here is the full command output:
cc @bhamail / @DarthHater
The text was updated successfully, but these errors were encountered: