-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[BUG] npm audit ambiguously states "found 0 vulnerabilities" #1951
Comments
@evilpacket, maybe something for your interest, good sir? |
I agree, the design intention is to not print audit information at all if the endpoint didn't return anything, so "0 vulnerabilities" is a bug. But I think a message indicating that we tried to audit and failed would be more informative and helpful. |
Thank you! I'm very happy to debug, if needed, and give you a proper status code, etc. if you give me instructions on how to enable that. |
If we're running the 'audit' command, then a failed endpoint means that the command failed. Error out in that case. Otherwise, if it's a quick audit as part of another command, just return a value to indicate that we should not print audit info. This avoids showing '0 vulnerabilities found', which, while amusingly technically correct, is misleading and not very helpful. Fix: #1951
If we're running the 'audit' command, then a failed endpoint means that the command failed. Error out in that case. Otherwise, if it's a quick audit as part of another command, just return a value to indicate that we should not print audit info. This avoids showing '0 vulnerabilities found', which, while amusingly technically correct, is misleading and not very helpful. Fix: #1951
If we're running the 'audit' command, then a failed endpoint means that the command failed. Error out in that case. Otherwise, if it's a quick audit as part of another command, just return a value to indicate that we should not print audit info. This avoids showing '0 vulnerabilities found', which, while amusingly technically correct, is misleading and not very helpful. Fix: #1951 Credit: @isaacs Close: #1956 Reviewed-by: @darcyclarke
Follow-up on what this looks like after installing 7.0.1. I no longer see an ambiguous message upon install, and npm audit correctly tells me about the error that was encountered. Thank you, @isaacs! |
Current Behavior:
We use Azure Artifacts which is a part of Azure DevOps to host our npm packages. We configured an upstream to the public npm registry to obtain public packages.
When executing
npm audit
against the public npm registry, we see a proper list of vulnerabilities for a large private package we maintain but when executing the same command against Azure Artifacts, we are ambiguously told "found 0 vulnerabilities".This isn't new behavior, but it's still evident in npm 7. We have known that Azure Artifacts does not support the endpoint that is called by the audit. I don't recall the response it issues, but I suspect a 4xx of sorts.
This is problematic because it gives a false sense of security to developers, devops engineers, etc.
Expected Behavior:
What would be more appropriate to display would be a message that the audit-related endpoint is not implemented, errored, etc. and that the npm cli was thus unable to determine the status of vulnerabilities.
Steps To Reproduce:
npm audit
to see the package appears to have zero vulnerabilities.Environment:
The environment is fairly irrelevant here, but I run NodeJS 14.13.1 and npm 7.0.0.
The text was updated successfully, but these errors were encountered: