Skip to content

chore(ci): gate dependency licenses with cargo-deny - #37

Merged
fastrevmd-lab merged 1 commit into
mainfrom
chore/deny-license-gating
Aug 20, 2026
Merged

fastrevmd-lab merged 1 commit into
mainfrom
chore/deny-license-gating

Conversation

@fastrevmd-lab

Copy link
Copy Markdown
Member

Adds a deny.toml and turns on the licenses check that CI has been skipping.

Why

.github/workflows/security.yml ran cargo-deny check bans sources and deliberately omitted licenses, because with no deny.toml cargo-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 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 narrowing [graph] targets rather 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] targets covers 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, which is precisely the hole this PR exists to close.

The publish = false markings

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.

Verification

  • cargo deny check advisories bans sources licenses → advisories ok, bans ok, licenses ok, sources ok, with both Linux targets in the graph
  • cargo clippy -p rustez / -p rustez-py with -D warnings → clean
  • 57 unit + 4 doctests pass
  • cargo audit → clean over 237 crates
  • cargo publish -p rustez --dry-run → packages clean

One thing only CI can confirm

cargo-deny-action v2.1.1 bundles its own cargo-deny, which may differ from the 0.20.2 used locally. If its config schema differs, the licenses step will say so — that is the specific thing to watch on this PR.

🤖 Generated with Claude Code

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>
@fastrevmd-lab
fastrevmd-lab merged commit e1eee15 into main Aug 20, 2026
3 checks passed
@fastrevmd-lab
fastrevmd-lab deleted the chore/deny-license-gating branch August 20, 2026 01:51
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