Skip to content

Json output does not respect deny options #376

Closed

Description

@alan-signal

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.

Activity

  1. Ekleog-NEAR commented on Nov 18, 2023

    @Ekleog-NEAR

    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 :)

  2. Shnatsel commented on Nov 19, 2023

    @Shnatsel
    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.

  3. djc commented on Oct 29, 2026

    @djc
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions