Skip to content

Improve the deno audit exit code #31702

@Amatewasu

Description

@Amatewasu

Version: Deno 2.6.3

Thank you for bringing deno audit! Currently, deno audit returns a exit code of 1 if it has a vulnerability with a severity high regardless of the level passed in params.

$ deno -v
deno 2.6.3
$ deno audit
..
Found 12 vulnerabilities
Severity: 2 low, 6 moderate, 4 high, 0 critical
$ echo $?
1
#
$ deno audit --level=high
...
Found 12 vulnerabilities
Severity: 2 low, 6 moderate, 4 high, 0 critical
$ echo $?
1
#
$ deno audit --level=critical
...
Found 12 vulnerabilities
Severity: 2 low, 6 moderate, 4 high, 0 critical
$ echo $?
1
# ❌ should it not returns 0? because if i filter only on critical packages, it should be an error only if there's one severity equals or greater to the selected severity level

If the level parameters is passed, should it not returns 0 or 1 whether there's a vulnerability with a severity equals or greater than the level specified?

Actually, according to npm's website, the behavior I suggest is the one npm has implemented: npm audit exit code behavior.

If vulnerabilities were found the exit code will depend on the audit-level configuration setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions