-
Notifications
You must be signed in to change notification settings - Fork 28
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
--audit-level pass-through does not behave as expected #22
Comments
Oh. Your note explains it all. check-audit ignores exit code from npm/yarn because even if exit code is >0 it may be ok after we apply the ignore rules. Looks like It'll have to be a feature request. |
Should this be entered in #1? I would be interested in the same functionality. |
It's good here. #1 is for stuff you're not sure about. I wonder if it'd make sense to handle this transparently, but then I'd have to go through all options for both npm and yarn to be consistent and not cause confusion why some of them work and some don't. So I'd rather go with rules you'd need to specify in the audit-resolve file. Unless there's a general rule that applies here. But if I just passed successful exit code in this case, the content would come up in resolver for review anyway and you'd have to take action. |
--audit-level flag is not working in my situation. It's not clear to me if it should work or not but judging from the comments above or if this would work in a new version? At the very least i would love something like a --ignoreLowVulnerabilities flag seeing as i get some low vulnerabilities and one moderate or above. Could something like this be supported? |
again, --audit-level only changes the exit code of audit process, but doesn't change the output and output is the only thing resolver can reasonably use. The functionality will come to the resolver. But some form of auto-ignoring certain level will be supported. |
I'm considering changing the behavior in v3 to exit 0 if oriinal command |
Anybody who needs this still here? I'd like to pick it up and discuss the solution in latest context. |
I could still use this. I'd like to pass-through |
In other words - if Wondering if it should always be the case or only if certain flags are detected. |
Always the case (independent of flags) seems logical to me. |
Assuming npm doesn't accidentally exit 0 in some configuration... |
Ok, so I implemented this. |
@naugtur thanks; I'll try as soon as there is a published version |
Not what I hoped for but I'll take it |
I installed this commit globally and it worked as expected/desired npm i -g git+https://github.com/naugtur/npm-audit-resolver#ba17250
npm ls -g --depth 0
.nvm/versions/node/v14.21.2/lib
├── npm@6.14.17
└── npm-audit-resolver@3.0.0-7 (git+https://github.com/naugtur/npm-audit-resolver.git#ba17250) check-audit --audit-level high
echo $?
1 check-audit --audit-level critical
echo $?
0 |
Fixed in npm-audit-resolver#ba17250 |
Awesome! Any ETA on when the fix will be officially part of |
I just need to make sure it's complete and release 3.0.0. |
Get well soon. |
Are there still plans for "some form of auto-ignoring certain level" as you referenced in #22 (comment) ? Using Scenario:
Expected the check-audit would succeed, but it exits with non-zero exit code. |
I thought I implemented that. Aaaand I just rubber-duckied the problem by writing about it. We'd need to implement audit level in resolver or make npm audit --json not return the issues below the level and what it's doing now seems to be just deciding the exit code. So to sum up, I won't fix that for 3.0.0 but it's definitely doable as 3.1.0 |
yes, and as you mention, |
Ok, so we'd have to implement this as a feature to do the filtering. |
It could be more convenient if it were an arg (--audit-level or other arg) or an env var. Then we'd be able to add that into the shared CI/CD template as the default rather than adding it into the audit-resolve.json of every repo. That said, it's certainly pretty easy to add a new rule into all the audit-resolve.json files. |
Would the configuration be a true/false flag? or it'd be the level? For some reason I'd initially thought it would be a true/false flag, but probably you meant it would be the level to filter? A true/false flag in the audit-resolve.json rules works fine in our case, but putting the level in the audit-resolve.json file is less convenient. We found it didn't scale well to always detect all levels of audit issues in our pipelines for N microservices. These |
An observation and possibly a bug.
I tried passing
--audit-level moderate
in v2.2.0 as a replacement for the removed ignoreLow support (#19), but it is not working as I expected. Even though npm audit succeeded (exit: 0), check-audit failed:NOTE:
--audit-level
does not change the output, it only changes the exit code.Repro:
The text was updated successfully, but these errors were encountered: