Skip to content
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

Json output does not respect deny options #376

Open
alan-signal opened this issue May 26, 2021 · 2 comments
Open

Json output does not respect deny options #376

alan-signal opened this issue May 26, 2021 · 2 comments

Comments

@alan-signal
Copy link

alan-signal commented May 26, 2021

0.14.1

Reproduction steps

  1. Create a repo with a warning, e.g.:
[dependencies]
cpuid-bool = "0.2"
  1. Run $cargo audit and see the warning.

  2. Promote that warning to an error and see the error $cargo audit --deny warnings.

  3. Now run with and without --deny warnings and --json.

$ cargo audit --json
$ cargo audit --deny warnings --json

Expect

The warning to be promoted to an error in the json.

Actual

No difference is seen, it remains a warning:

  "warnings": {
    "unmaintained": [
      {
        "kind": "unmaintained",
        "package": {
          "name": "cpuid-bool",
          "version": "0.2.0",

Additionally, you can reproduce this with a .cargo/audit.toml:

 [output]
 deny = ["unmaintained", "unsound", "yanked"]
 quiet = false

Consequences

The audit-check which uses --json cannot be made to fail on warnings. See: actions-rs/audit-check#132 (audit-check requires that it is solved for the .cargo/audit.toml case.)

I have not investigated whether other relevant command line/audit.toml options are respected in json output when they should be.

An MCVE is here: alan-signal/cargo-audit-action#1 with the issue as seen with audit-check.

@Ekleog-NEAR
Copy link

I’m hitting this too, it seems like it’s not possible to have the audit-check action deny warnings currently, unfortunately. I guess I’ll stay with a hand-rolled audit action, even though it’s sad considering the work that seems to have been put into the audit-check action :)

@Shnatsel
Copy link
Member

In the latest release of rustsec I have aligned warnings to contain all the information that errors do, so this should not be too hard to fix now.

I'm not sure I will be able to get around to fixing this myself soon, though. A PR would be welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants