Ensure no commercial crates are part of the OSS builds - #1248
Ensure no commercial crates are part of the OSS builds#1248dani-garcia wants to merge 4 commits into
Conversation
296d44c to
dbd2648
Compare
dbd2648 to
7224fdc
Compare
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR fixes a commercial-code leak where Code Review DetailsNo blocking findings. Verification notes:
|
🔍 SDK Breaking Change DetectionSDK Version:
Breaking change detection uses the build of the SDK from this branch, including any incompatibities pre-existing on or merged into this branch. Check the workflow logs to confirm. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1248 +/- ##
=======================================
Coverage 85.49% 85.49%
=======================================
Files 482 482
Lines 67340 67340
=======================================
Hits 57573 57573
Misses 9767 9767 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
# Conflicts: # Cargo.lock # bitwarden_license/bitwarden-pam/Cargo.toml # bitwarden_license/bitwarden-pam/src/lib.rs
🎟️ Tracking
📔 Objective
Commercial (Bitwarden-licensed) crates under
bitwarden_license/must never ship in a non-commercial build, but a non-weak feature reference silently defeated that:bitwarden-pm'swasmfeature listed"bitwarden-commercial-vault/wasm", which force-activates the optional dependency wheneverwasmis enabled. Sincebitwarden-wasm-internalalways buildsbitwarden-pmwithwasm, the standard non-commercial WASM artifact was compiling in commercial code unnoticed.This PR fixes the leak and adds a compile-time guard so it can't come back:
bitwarden-commercial-vault?/wasm) in every feature exceptbitwarden-license.bitwarden-commercial-markerexports acommercial_crate!()macro that expands to acompile_error!under--cfg bitwarden_ensure_non_commercial. Everybitwarden_license/crate calls it (and the marker self-invokes), so any commercial crate in the graph poisons such a build.cargo-udepskeeps the dep and the call in sync.RUSTFLAGS="--cfg bitwarden_ensure_non_commercial"(WASMbuild.shnon--bvariant,swift/build.sh), turning a leak into a hard build failure.bitwarden-uniffihas no commercial crates for the moment, so its mobile builds set the cfg unconditionally.Adding a new commercial crate only requires the one-line marker dependency plus the
commercial_crate!()call;bitwarden_license/CLAUDE.mddocuments this with a reviewer checklist.bitwarden-pam(re-added here) is the first case.🚨 Breaking Changes