Skip to content

Fix security audit result handling and trigger scope - #440

Merged
jadamcrain merged 1 commit into
mainfrom
fix/security-audit-workflow
Jul 27, 2026
Merged

Fix security audit result handling and trigger scope#440
jadamcrain merged 1 commit into
mainfrom
fix/security-audit-workflow

Conversation

@jadamcrain

Copy link
Copy Markdown
Member

Derives the audit verdict from the cargo-audit JSON report instead of the process exit status, so tool and network failures are no longer reported as vulnerabilities. Also runs the audit on every PR, surfaces advisory warnings as annotations, and hardens the workflow permissions and action pinning.

Run cargo audit exactly once and derive the verdict from the JSON report
rather than the process exit status. The previous logic treated any nonzero
exit as "vulnerabilities detected", so a network or advisory database failure
produced a misleading job summary. It also invoked cargo audit twice, making
the outcome depend on which of the two runs failed, and redirected stderr into
audit.json, which meant the report was not necessarily valid JSON.

Warnings (unmaintained, yanked, unsound) are now emitted as workflow
annotations, since cargo-audit prints nothing in JSON mode and the second
invocation was previously the only thing surfacing them. The report is also
uploaded as an artifact.

Drop the paths filter from the pull_request trigger so every PR gets a
consistent audit verdict. The job only binstalls a prebuilt cargo-audit and
reads Cargo.lock, so it is inexpensive relative to the rest of CI, and an
unfiltered trigger is a prerequisite for making this a required status check,
as a path-filtered workflow reports no status at all.

Add an explicit read-only permissions block and pin cargo-binstall to a commit
SHA instead of tracking a mutable branch.
@jadamcrain
jadamcrain merged commit 562071e into main Jul 27, 2026
33 checks passed
@jadamcrain
jadamcrain deleted the fix/security-audit-workflow branch July 27, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant