Repository navigation
fix(cargo-deny): run dependency license checks in CI, clarify inaccurate licenses - #3299
dannycjones wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new script advertises Python 3.11 support but contains Python 3.12-only syntax.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds CI enforcement for dependency licenses and clarifies effective licenses for bundled dependencies.
Changes:
- Introduces a Python license-checking CLI.
- Adds
cargo-denychecks to CI. - Separates dependency TSV generation from source license checks.
| File | Description |
|---|---|
.github/workflows/ci.yml |
Runs dependency license validation in CI. |
Makefile |
Renames the source license target. |
deny.toml |
Clarifies zstd and Brotli licensing. |
dev/check_src_license_notice.sh |
Validates packaged LICENSE and NOTICE files. |
dev/release/licenses.py |
Implements license checks and hash generation. |
dev/release/generate-dependency-tsv-files.sh |
Focuses the script on TSV generation. |
dev/release/README.md |
Updates release commands. |
website/src/release.md |
Updates public release instructions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
91b30c0 to
5de2d26
Compare
5de2d26 to
cc209f4
Compare
|
@kevinjqliu @CTTY would you be able to take a look at this change? Ultimately, this is on the path to unblock 0.11 release. (I plan to add attribution note generation to the Python script introduced here) Note, there's a similar change adding cargo-deny to CI in #3293. I think there's some good/needed changes in there, although I think we should move to the new Python script this PR proposed. |
| # However, it also includes vendored Zstandard C sources. | ||
| [[licenses.clarify]] | ||
| crate = "zstd-sys" | ||
| # TODO: When workspace upgrades to zstd-sys 2.1 or later, |
There was a problem hiding this comment.
maybe we can have a GH issue for this?
There was a problem hiding this comment.
I'll open one and link to it. That being said, I'm not convinced issues are great for things like this as they tend to go stale at the moment. (Maybe I should be more optimistic!)
| expression = "BSD-3-Clause AND MIT" | ||
| license-files = [ | ||
| { path = "LICENSE", hash = 0x1a60a92d }, # BSD-3-Clause | ||
| # Missing: MIT license, since no license text is included in the crate's repo. |
There was a problem hiding this comment.
not sure why this comment is here
There was a problem hiding this comment.
With the license-files section, I want to relate the file back to the expression I've written above. The license files prove that the new license expression is correct.
I'm asserting above that the license is BSD-3-Clause AND MIT, so it feels odd to link only to the BSD-3-Clause license. I am explaining why the MIT license is missing.
I can reword to something like this.
# Missing: crate is MIT licensed but has no license text to refer to.
# This means if the project drops the MIT license, we wouldn't know to update expression above.| { path = "zstd/COPYING", hash = 0xeaa66bfd }, | ||
| ] | ||
|
|
||
| # The declared license is inaccurate, as the crate src includes both MIT and BSD-3-Clause licensed code |
There was a problem hiding this comment.
do we really need this comment? 🤔
There was a problem hiding this comment.
This is probably too much info.
I'll update it to simply refer to the upstream PR, which has the necessary context.
comphead
left a comment
There was a problem hiding this comment.
Thanks @dannycjones it mostly LGTM, couple of nits.
Wondering how this has been tested?
I've been testing by manually (with LLM) running this scenario, which includes:
Applying this patch over the deny.toml. diff --git a/deny.toml b/deny.toml
index 7f4b2a7c8..ad346cd13 100644
--- a/deny.toml
+++ b/deny.toml
@@ -50,11 +50,13 @@ expression = "(MIT OR Apache-2.0) AND BSD-3-Clause AND (GPL-2.0-only OR BSD-3-Cl
license-files = [
{ path = "LICENSE.Apache-2.0", hash = 0x7b466be4 },
{ path = "LICENSE.Mit", hash = 0xa237d234 },
+ # A file that was removed upstream but is still attested here.
+ { path = "LICENSE.Apache", hash = 0xbadbad04 },
{ path = "LICENSE.BSD-3-Clause", hash = 0xc9f5c4f6 },
# BSD-3-Clause of vendored zstd src
{ path = "zstd/LICENSE", hash = 0x3bfe1fb1 },
# GPL-2.0-only of vendored zstd src
- { path = "zstd/COPYING", hash = 0xeaa66bfd },
+ { path = "zstd/COPYING", hash = 0xbadbad01 },
]
# Mapped from OR to AND. The following PR should address upstream.
@@ -63,7 +65,15 @@ license-files = [
crate = "brotli-decompressor"
expression = "BSD-3-Clause AND MIT"
license-files = [
- { path = "LICENSE", hash = 0x1a60a92d }, # BSD-3-Clause
+ { path = "LICENSE", hash = 0xbadbad02 }, # BSD-3-Clause
# Missing: crate is MIT licensed but has no license text to refer to.
# If the project drops the MIT licensing, we wouldn't know to update expression above.
]
+
+# A dependency that was dropped, but whose clarification was left behind.
+[[licenses.clarify]]
+crate = "openssl-sys"
+expression = "Apache-2.0"
+license-files = [
+ { path = "LICENSE", hash = 0xbadbad03 },
+]Basically checking that addressing each one gets us back to the toml that will be merged into main. I'm not super happy with it being manual tests but I don't think its worth investing more here right now. |
I don't follow. Are you referring to ignoring files that cargo-deny suspects may be a license but it can't classify? I'm not actually sure how we'd navigate that one right now - I suspect we'd need to add a clarify block to specify the files to care about, so the misclassified one is dropped. I'm inclined to leave it until we encounter it for now. |
|
Thanks for the review, @comphead. I've addressed most of the feedback. |
kevinjqliu
left a comment
There was a problem hiding this comment.
thanks for the changes. I think it'll be a good idea to split this up into multiple prs. with infra level changes, i prefer the changes and prs to be self documenting.
I think we can do a few prs
- remove
DEPENDENCIES.rust.tsvand its related infra. we mentioned to do this in #3233 - Add cargo deny to CI
- Fix / improve the release process
There was a problem hiding this comment.
i need to triple check these changes
| ## Dependencies | ||
|
|
||
| Use the dependency helper to update or verify dependency license lists: | ||
| Regenerate each package's `DEPENDENCIES.rust.tsv`: |
There was a problem hiding this comment.
should we just remove all the DEPENDENCIES.rust.tsv and related infra?
There was a problem hiding this comment.
Yeah, might make things simpler. I'll open that PR today and also put a note to the mailing list that its happening. We can revert if there's push back.
|
i also noticed #3293, maybe we can use that PR as the "Add cargo deny to CI" part |
I'm happy to do that, I think that makes sense. Let's get that one in, I'll strip out TSVs, then we do migration to Python script then wheel attribution note generation. |
|
do you think this PR is superseded by #3293? |
Ish - I will close this now, I plan to open new ones to a) add clarify notices where appropriate and b) move us to a Python script which I'll build on for the wheel attribution notices. |


Which issue does this PR close?
This is also part of a few changes related to #3239.
What changes are included in this PR?
A new Python script is introduced for handling licenses. In this change, the existing cargo-deny check is moved from the Bash script to this new script, paving the way for further script commands that tackle generation of distribution notices for the compiled Python bindings.
In addition, some dependencies whose declared license doesn't match the effective license have been clarified using the config in deny.toml. There is no impact, just an improvement to ensure it is correctly evaluated.
Are these changes tested?
No. However, the new checks will run against this and future PRs.
AI Disclosure
Used LLM to generate the script content, which is later reviewed, restructured, and otherwise modified by me. Also relied on LLM to dive deep and identify any inaccurate licenses that have now been verified by me and clarified in config.