Skip to content

cargo-deny and the license inventory both stop at the root workspace: 68 third-party crates in example workspaces are unenforced #663

Closed

Description

@vyncint

Description

cargo deny check resolves the root workspace, and the guard added in #662 checks the same graph against dependency-licenses.csv. Every example under crates/rustc-codegen-cuda/examples/ is its own [workspace], so neither sees any of them. Six examples declare third-party dependencies, pulling 68 distinct crates that are in neither the root dependency graph nor the CSV — and nothing enforces the license policy over any of them.

This is not a violation today, and I want to be precise about that: deny.toml's allow-list (MIT, Apache-2.0, Apache-2.0 WITH LLVM-exception, BSD-2-Clause, BSD-3-Clause, ISC, Unicode-3.0, Zlib) plausibly covers all 68, though I have not resolved each crate's license to confirm it. The problem is that if it did not, no gate would say so.

Where the 68 come from

Example Uncovered crates Direct declarations
cutile_inter_kernel 62 cutile, cutile-compiler, cutile-cuda-core (git), tokio
hashmap_v2 5 rayon
hashmap_v3 5 rayon
async_mlp 2 tokio
async_vecadd 2 tokio
libm_math 1 libm

cutile_inter_kernel dominates because the cutile-rs git dependency pulls a large transitive graph — wasm-bindgen, wit-bindgen, wasmparser, windows-targets, parking_lot, rand, phf, and so on. The others are small: rayon brings crossbeam-*, tokio brings mio/socket2.

half and hashbrown are not in this list — they already appear in the root graph, so they are covered.

Why this is in scope

#662 established that the CSV legitimately records crates from outside the root workspace: libmathdx-sys lives under examples/mathdx_ffi_test/ and has a row. So "examples are out of scope" is not the existing convention.

These crates are also not hypothetical — they are compiled by a documented workflow. cargo oxide run cutile_inter_kernel builds all 62, and scripts/smoketest.sh builds them on every full run.

Expected behavior

Either the license policy covers third-party code compiled from this tree, or the exemption is written down. Right now the gate silently stops at the root workspace boundary.

Suggested fix

Extend scripts/check-dependency-licenses.sh with a second assertion: for each example workspace, every package in its Cargo.lock must appear in the root graph, in the CSV, or be first-party. That is pure lock-file parsing — no cargo metadata, no network, no build scripts — so it runs in the same CPU-only job the #662 guard already uses, and it is self-maintaining: the next example that adds a dependency fails until its rows land.

It also correctly ignores the 172 examples that declare only path dependencies, so the check is over 6 workspaces in practice rather than 178.

One scope decision for you

Adding the 68 rows is mechanical but cutile_inter_kernel contributes 62 of them, which is a large block of wasm-bindgen/wit-bindgen machinery that exists only because one example links a git dependency. Two defensible answers:

  1. Record them. The CSV becomes a complete inventory of third-party code compiled from the tree.
  2. Gate but exempt. Add the check, and let an example declare its deps out of inventory scope — on the grounds that examples are not distributed artifacts — with the exemption recorded in the file rather than implied by a workspace boundary.

I lean towards (1) for the five small examples and would rather hear your preference on cutile_inter_kernel than guess, since it is the one that meaningfully grows the file. Happy to implement either.

Related

Same shape as #643, #645 and #661 — a guard whose coverage silently stopped short of what it appeared to check.

Also noted while measuring, and not proposed for action here: crates/rustc-codegen-cuda is its own workspace too, but its 93-package graph is a strict subset of the root's 160, so cargo deny check already covers every third-party crate the shipped backend uses. Only the first-party rustc_codegen_cuda crate itself lacks a CSV row.

Environment

  • Measured at e28248c1
  • No GPU, CUDA toolkit or LLVM required; figures come from parsing Cargo.lock files

Activity

  1. added
    build-related
    QoL-improvement
    on Aug 6, 2026
  2. vyncint commented on Aug 6, 2026

    @vyncint
    ContributorAuthor

    Measured this properly, and two things in my original report need correcting — plus the answer to the open question turns out to be no.

    The count was 68; it is actually 131. I only counted the six examples with declared third-party dependencies. The real figure is the delta between each example lock and the root graph, which pulls in transitive build-dep graphs I missed (bindgen, clang-sys, libloading, zerocopy, …). Root workspace resolves 139 third-party crates; the example workspaces add 131 distinct crates beyond it, and all 187 examples add at least one.

    I wrote "This is not a violation today". That was wrong. Running the policy over every example workspace finds a live advisory:

    error[vulnerability]: Invalid pointer dereference in `fmt::Pointer` impl for `Atomic` and `Shared`
    crossbeam-epoch 0.9.18 — RUSTSEC-2026-0204
      crossbeam-epoch v0.9.18
      └── crossbeam-deque v0.8.6
          └── rayon-core v1.13.0
              └── rayon v1.12.0
                  └── hashmap_v2 v0.1.0
    Solution: Upgrade to >=0.9.20
    

    It affects hashmap_v2 and hashmap_v3. Nothing reports it, exactly as the issue predicted — I just did not expect to find one.

    Full result: 186 of 187 example workspaces satisfy deny.toml unchanged once that advisory is fixed. The remaining one is cutile_inter_kernel, which genuinely cannot:

    error[source-not-allowed]: detected 'git' source not explicitly allowed   (x7)
    error[unlicensed]: cuda-bindings = 0.1.0 is unlicensed
    bans ok, licenses FAILED, sources FAILED
    

    The first needs cutile-rs in [sources] allow-git; the second needs a license field on a crate this repo does not own. Both are your calls, so I have left it exempt rather than loosening the policy.

    PR coming that closes the policy half: a guard running cargo deny check per example workspace, and the crossbeam-epoch bump so it lands green. #664 already closed the inventory half.

  3. added
    supply-chain
    examples
    on Aug 7, 2026
  4. vyncint commented on Aug 10, 2026

    @vyncint
    ContributorAuthor

    Resolved. Both halves are enforced in CI now:

    cargo-deny.yml now names this issue directly in its header comment, so the
    gap this tracked is both closed and documented at the point of enforcement.

  5. added a commit that references this issue on Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    QoL-improvementbuild-relatedexamplessupply-chain

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions