-
Notifications
You must be signed in to change notification settings - Fork 29
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
Unexpected Behavior When Scanning Non-Existing and Latest Versions of npm Packages #292
Comments
@AmalChandru Thanks for reporting this. Lets talk about [1] first. I tried running
This tells me the package and its transitive dependencies (upto a certain depth). I don't see any vulnerabilities reported by When I run the same command but with our default policy, I do see some violations:
At this point, I am not sure how to check the known vulnerabilities for |
I believe my choice of the term "known vulnerabilities" might have caused some confusion. What I intended to highlight is the major version drift in the direct dependency (can pose a security vulnerability), which is already being detected by Vet. As shown in Fig. 2, it's indicating that one library is out of date due to a major version drift in the direct dependencies. |
@AmalChandru I believe the bug related to major version drift especially where it is asking to update https://github.com/safedep/vet/blob/main/pkg/reporter/summary.go#L447 This needs some analysis on how to handle this case. |
Thanks for the pointer @abhisek 🙏 Currently, the To improve this, what about adding a check to determine if the user-specified version is greater than the current version ? If it is, we can notify the user that the provided version is invalid or implement an alternative feedback mechanism. Here’s an example of how this could be implemented: // Check if the user input version is greater than the current version
userVersion, _ := semver.NewVersion(pkg.PackageDetails.Version)
currentVersion, _ := semver.NewVersion(insightsCurrentVersion)
if userVersion.GreaterThan(currentVersion) {
fmt.Printf("Provided version %s is greater than the current version %s.\n", pkg.PackageDetails.Version, insightsCurrentVersion)
return "Provided version is not valid."
} |
@AmalChandru How about change Implementing Given the complexity in dealing with versions I think we should first fix the naming before dealing with version complexities. Feel free to raise a PR to fix the column name if you agree. |
@abhisek Addressing the column naming first makes sense before tackling the broader version-handling logic. I'll go ahead and raise a PR to update the column name. |
Description:
I was playing around with Vet locally and encountered a couple of issues when scanning one of my npm libraries:
1.0.2
. However, when scanning with that version, no vulnerabilities or issues were detected, despite known security vulnerabilities. Ideally, when the latest version of a package is provided, it should run and display results in the CLI. Is this expected behavior? [fig:1]11.0.0
(which doesn’t exist), the system suggested updating to1.0.2
, even though11.0.0
is not available. Ideally, Vet should flag an invalid version as feedback. Shouldn’t it? [fig:2]Steps to reproduce:
vet scan --purl pkg:npm/[email protected]
vet scan --purl pkg:npm/[email protected]
1.0.2
.Expected behavior:
Screenshots:
The text was updated successfully, but these errors were encountered: