build: add a license gate for shipped npm packages and Rust crates (P2.3)

scripts/check-licenses.mjs (npm run check:licenses) reads the production
dependency closures of the sidecar (@waggle/server minus the packages
stage-sidecar-deps.mjs never ships) and the web UI (apps/web) from
package-lock.json and fails on GPL, AGPL, SSPL, missing and unknown
licenses. It allows permissive licenses plus MPL-2.0 and lists named
exceptions with reasons; LGPL libvips and node-webpmux, the OFL fonts and
the unlicensed buffers package are marked as pending the licensing review.

app/src-tauri/deny.toml applies the same allowlist to the Tauri crates with
cargo-deny; the npm check fails when the two lists drift apart. A new CI
job runs both, with cargo-deny 0.18.3 installed and cached in CI.

scripts/license-inventory.mjs holds the shared closure logic.
This commit is contained in:
shumeiko.it
2026-11-01 00:30:06 +01:00
parent 5a7f3d24d9
commit 3ebe97e033
6 changed files with 720 additions and 0 deletions

38
app/src-tauri/deny.toml Normal file
View File

@@ -0,0 +1,38 @@
# cargo-deny license gate for the desktop shell.
#
# cargo deny --manifest-path app/src-tauri/Cargo.toml check licenses
#
# Same policy as scripts/check-licenses.mjs for the npm packages: the allow
# list below must match ALLOWED_LICENSES there (that script fails when they
# differ). Crates that need anything else get a named entry in `exceptions`
# with the reason in a comment.
[graph]
# The v1 desktop platforms (docs/oss/adr/README.md).
targets = [
"x86_64-pc-windows-msvc",
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
]
[licenses]
allow = [
"0BSD",
"Apache-2.0",
"BSD-2-Clause",
"BSD-3-Clause",
"BlueOak-1.0.0",
"CC0-1.0",
"ISC",
"MIT",
"MPL-2.0",
"Python-2.0",
"Unicode-3.0",
"Unlicense",
"Zlib",
]
confidence-threshold = 0.93
# The allow list is shared with the npm check, so not every entry is used here.
unused-allowed-license = "allow"
exceptions = []