-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Support for the --audit-level flag passing to npm audit #4
Comments
hmm it would be hard to implement with the current method - reads the vulnerability IDs from the generated report using a simple regex:
One way that I can think of doing this is by collecting all the severity levels (low, high, critical, etc.) and also collecting all the vulnerability IDs, and map them together, but this might not be 100% accurate. I can add the flag I'll try to think of something about this, meanwhile, any ideas / PRs are welcome :) |
I've put a Pull Request together that allows support for this, as-well as accommodating a production flag that I've raised another issue for. Simplest approach was to use JSON for the processing. |
JSON approach looks great! Thank you for contributing @IPWright83 |
I tested with a few repositories, for some of my old repositories they have many vulnerabilities warnings, that I think resulted in an oversized buffer exceeds the limit and caused the child process to be terminated: here I get the incomplete JSON buffer:
So I put some logs to the buffer and I get this:
8192 bytes is the maximum limit for each chunk and I think we can't increase it (actually we don't have to deal with the chunk size). We only have to increase the Thanks again! |
@jeemok just to check after re-reading this. The buffer size shouldn't be a problem with the JSON approach as it just keeps adding to the |
@IPWright83 so I was testing with my old repository that has lots of vulnerabilities, and the JSON was invalid as the child process close before receiving all the chunks from the streaming. The default maximum size for the
So what I did is just increasing that to 50 MB and it should work for most cases. Actually, maybe we should add handling there if it ever exceeds 50MB, we should throw a warning or something. |
It would be nice to only consider vulnerabilities after a given level.
The text was updated successfully, but these errors were encountered: