Repository navigation
chore(ci): gate dependency licenses with cargo-deny - #37
Merged
Merged
Conversation
The security workflow ran `cargo-deny check bans sources` and deliberately
skipped `licenses`, because with no deny.toml cargo-deny rejects every license
by default. The result was that nothing checked what we actually link against.
Adds deny.toml with a permissive allowlist covering the licenses present in the
tree, and switches the workflow to `check bans sources licenses` — without that
second change the config file would be inert.
[graph] targets is restricted to the platforms this workspace actually ships
for, which includes BOTH linux wheel targets built by publish-pypi.yml:
x86_64-unknown-linux-gnu (manylinux) and x86_64-unknown-linux-musl
(musllinux). Omitting musl would let a dependency gated on
cfg(target_env = "musl") ship in a published wheel with its license never
checked — the exact hole this change exists to close.
Notable finding while writing it: the unrestricted dependency graph contains
one copyleft crate, r-efi (LGPL-2.1-or-later). It arrives as a UEFI-target-only
dependency of getrandom, itself a build-dependency of aws-lc-sys:
r-efi -> getrandom -> jobserver -> cc -> cmake -> aws-lc-sys [build-deps]
-> aws-lc-rs -> russh -> rustnetconf -> rustez
It is never built, linked, or distributed on any platform we ship. It is
excluded by the targets narrowing rather than by a license exception, so that a
copyleft crate landing in a genuinely linked position still fails the check. No
copyleft license is on the allowlist.
`wildcards = "deny"` catches an unversioned dependency on a registry crate.
The workspace's internal `{ path = "../rustez" }` links are exempted via
allow-wildcard-paths, which only applies to crates marked `publish = false` —
so rustez-cli and rustez-py are now marked as such. That is independently
correct: per the documented release process neither goes to crates.io
(rustez-py ships to PyPI through maturin, rustez-cli is unpublished), and the
marking also prevents publishing either by accident. `rustez` itself is
untouched and still publishes — verified with `cargo publish -p rustez
--dry-run`.
Verified: cargo deny check advisories bans sources licenses -> all ok with both
linux targets in the graph; clippy -p rustez / -p rustez-py -D warnings clean;
57 unit + 4 doctests pass; cargo audit clean over 237 crates.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
deny.tomland turns on thelicensescheck that CI has been skipping.Why
.github/workflows/security.ymlrancargo-deny check bans sourcesand deliberately omittedlicenses, because with nodeny.tomlcargo-deny rejects every license by default. Net effect: nothing checked what we actually link against or ship.Both halves are needed — the config file alone would be inert without the workflow change.
What the graph turned out to contain
The unrestricted dependency graph has one copyleft crate:
r-efi(LGPL-2.1-or-later). It arrives as a UEFI-target-only dependency ofgetrandom, itself a build-dependency ofaws-lc-sys:It is never built, linked, or distributed on any platform we ship. It is excluded by narrowing
[graph] targetsrather than by a license exception, so a copyleft crate landing in a genuinely linked position still fails the check. No copyleft license is on the allowlist.[graph] targetscovers both Linux wheel targets built bypublish-pypi.yml—x86_64-unknown-linux-gnu(manylinux) andx86_64-unknown-linux-musl(musllinux). Omitting musl would let a dependency gated oncfg(target_env = "musl")ship in a published wheel with its license never checked, which is precisely the hole this PR exists to close.The
publish = falsemarkingswildcards = "deny"catches an unversioned dependency on a registry crate. The workspace's internal{ path = "../rustez" }links are exempted viaallow-wildcard-paths, which only applies to crates markedpublish = false— sorustez-cliandrustez-pyare now marked as such.That is independently correct: per the documented release process neither goes to crates.io (
rustez-pyships to PyPI through maturin,rustez-cliis unpublished), and the marking also prevents publishing either by accident.rustezitself is untouched and still publishes — verified withcargo publish -p rustez --dry-run.Verification
cargo deny check advisories bans sources licenses→advisories ok, bans ok, licenses ok, sources ok, with both Linux targets in the graphcargo clippy -p rustez/-p rustez-pywith-D warnings→ cleancargo audit→ clean over 237 cratescargo publish -p rustez --dry-run→ packages cleanOne thing only CI can confirm
cargo-deny-actionv2.1.1 bundles its own cargo-deny, which may differ from the 0.20.2 used locally. If its config schema differs, thelicensesstep will say so — that is the specific thing to watch on this PR.🤖 Generated with Claude Code