Skip to content

chore: add cargo-deny for license, duplicate and source checks - #47

Merged
lucatescari merged 1 commit into
devfrom
chore/cargo-deny
Aug 18, 2026
Merged

chore: add cargo-deny for license, duplicate and source checks#47
lucatescari merged 1 commit into
devfrom
chore/cargo-deny

Conversation

@lucatescari

Copy link
Copy Markdown
Owner

Adds a cargo deny check licenses bans sources job alongside the existing cargo audit job, plus a deny.toml policy file.

The advisories check is deliberately not run — cargo audit already covers RustSec and reports informational (unsound / unmaintained) findings as warnings. Running both would duplicate the signal.

What the three enabled checks buy

Check Guard
licenses Dependency licenses must be compatible with GPL-3.0-only. Current tree is permissive plus MPL-2.0 (colored) and Unicode-3.0 (unicode-ident), both GPL-compatible.
bans No crate at two versions — the guard against a second RustCrypto trait generation entering the graph, the exact failure .github/dependabot.yml already groups crates to avoid.
sources Every dependency must resolve to crates.io; fails on git or alternate-registry sources.

syn is the one skip: 2.x and 3.x coexist via zeroize_derive vs clap_derive/thiserror-impl, and both are proc-macro build-time only — they never reach the shipped binary.

Verification

  • cargo deny check licenses bans sourcesbans ok, licenses ok, sources ok, no warnings
  • Negative-tested that the checks actually bite: dropping MPL-2.0 from the allow list, or the syn skip, makes the run exit non-zero (exit 4) rather than passing vacuously
  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, and all 138 tests pass locally

No Rust code changed, so no new tests are needed; the CONTRIBUTING.md test count (138) is unchanged and still accurate.

🤖 Generated with Claude Code

Adds a `cargo deny check licenses bans sources` job alongside the
existing cargo audit job. The `advisories` check is deliberately left
out — cargo audit already covers RustSec, and running both duplicates
the signal without adding coverage.

What the three enabled checks buy:

- licenses: dependency licenses must be compatible with GPL-3.0-only.
  Current tree is permissive plus MPL-2.0 (colored) and Unicode-3.0
  (unicode-ident), both GPL-compatible.
- bans: no crate may appear at two versions. This is the guard against
  a second RustCrypto trait generation entering the graph, the failure
  mode .github/dependabot.yml already groups crates to avoid. syn is
  skipped: 2.x and 3.x coexist via zeroize_derive vs clap_derive and
  are proc-macro build-time only.
- sources: every dependency must resolve to crates.io, failing on git
  or alternate-registry sources.

Verified against the current tree: all three pass clean. Also verified
they actually bite — removing MPL-2.0 from the allow list or the syn
skip makes the run exit non-zero.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lucatescari
lucatescari merged commit 0ce4102 into dev Aug 18, 2026
5 checks passed
@lucatescari
lucatescari deleted the chore/cargo-deny branch August 18, 2026 07:42
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