Repository navigation
CI: Add cargo deny as a pre-merge CI check #3699
Description
Description
Type: ci / security
Labels: security, ci, dependencies, A-tooling
Source: discussion #3678
Summary
Wire cargo deny into the pre-merge CI pipeline
(.github/actions/rust/pre-merge) so every PR is gated on advisory scanning,
license policy, banned crates, and duplicate-version detection across the full
dependency graph. Mirror the check in the local pre-commit config so
contributors catch failures before pushing.
Motivation
cargo audit only covers known vulnerabilities. cargo deny is a superset
gate: in addition to RustSec advisories it enforces open-source license policy,
bans specific crates, and flags duplicate dependency versions. A pre-merge gate
prevents new advisories and policy violations from re-entering the tree after the
one-time remediation (sibling audit issue) lands.
Reference: https://github.com/EmbarkStudios/cargo-deny
Affected area / component
Other / not sure
Proposed solution
Proposed approach
- Add a committed
deny.tomlat repo root with sections:[advisories]— deny vulnerabilities/unsound; explicitignorelist for
accepted-risk advisories (each with a comment + review date). Seed from the
audit-remediation issue outcomes.[licenses]— allowlist ASF-compatible licenses (Apache-2.0, MIT,
BSD-2/3-Clause, ISC, Unicode-DFS, etc.); confirm against the existing
scripts/ci/third-party-licenses.shpolicy so the two do not conflict.[bans]— flag duplicate versions (multiple-versions = "warn"initially,
thendenyonce the tree is deduplicated); ban known-bad crates.[sources]— restrict to crates.io + explicitly allowed git sources.
- Add a CI step running
cargo deny check(advisories, licenses, bans, sources)
inside.github/actions/rust/pre-merge/action.yml, ordered after the existing
Rust verification steps. - Add a
scripts/ci/cargo-deny.shwrapper (consistent with existing
scripts/ci/*.sh) and wire it into.pre-commit-config.yaml.
Alternatives considered
No response
Contribution
- I'm willing to submit a pull request to implement this feature
Good first issue
- I think this could be a good first issue for a new contributor
Activity
[-]feat(security): Add `cargo deny` as a pre-merge CI check[/-][+]feat(ci/cd): Add `cargo deny` as a pre-merge CI check[/+]ryerraguntla commentedon Jul 18, 2026
justinmclean commentedon Oct 9, 2026
@ryerraguntla checking in, this is labelled good first issue but has been self-assigned since 18 Jul with just a draft config pasted. Still working on it, or should the assignment come off so a newcomer can pick it up?
the4amfriend commentedon Oct 22, 2026
@justinmclean Hey, can I pick this up if nobody is working on it?
the4amfriend commentedon Oct 25, 2026
@ryerraguntla The issue mentions an audit-remediation sibling issue for seeding the cargo-deny ignore list. I found discussion #3678 and issue #3700, but couldn't locate the remediation issue. Was it created? If so, could you link it?
I've been testing the cargo-deny configuration locally, and the advisory check currently reports 24 RustSec advisories (12 vulnerabilities and 12 unmaintained dependencies).
I'd like to avoid suppressing security findings without an agreed-upon baseline before submitting a PR. Could you clarify which advisories should be addressed or accepted as known risks?
Thanks!
[-]feat(ci/cd): Add `cargo deny` as a pre-merge CI check[/-][+]CI: Add `cargo deny` as a pre-merge CI check[/+]