Skip to content

Commit 05399a9

Browse files
ci: lint the whole workspace with clippy and add cargo-deny (#407)
## Summary CI currently runs `cargo clippy -- --D warnings`, which only lints the root crate with default targets — the `ffi`, `cli` and `uniffi` crates were never linted. This PR: - **Widens the CI clippy invocation** to `cargo clippy --workspace --all-targets -- -D warnings` (and fixes the `--D` → `-D` flag spelling). - **Fixes all 49 clippy findings** this surfaced, all in `ffi/src/lib.rs`: - Missing `# Safety` doc sections on the 16 online ciphertext FFI functions (docs added following the file's existing style, including notes that `OnlineEncryptorLastChunk`/`OnlineDecryptorLastChunk` consume the handle). - Doc list continuation-line indentation (`doc_overindented_list_items`). - Redundant `as *const u8` pointer casts. - Manual `% 4 != 0` replaced with `is_multiple_of`. - For the `mut_mutex_lock` warnings in the chunk functions: take a shared reference to the mutex and keep `lock()` (like the read-side accessors) instead of fabricating a `&mut` from the raw handle — the handle can be used from multiple threads, so the mutex must actually be acquired. - **Adds a `cargo_deny` CI job** (advisories, bans, licenses, sources), installing cargo-deny with `cargo install --locked` — same convention as cargo-fuzz in the extended fuzzing workflow, no third-party action. - **Migrates `deny.toml`** from the pre-0.14 schema (which current cargo-deny rejects) to the current one, keeping the same policy. Two adjustments so the check passes on today's dependency tree: - `Zlib` added to the license allow-list (`foldhash`, pulled in via `blahaj`). - `RUSTSEC-2024-0436` ignored with a comment: `paste` is an archived proc-macro dependency; replacing it (e.g. with `pastey`) is left as a follow-up. - **Refreshes `Cargo.lock`** to latest compatible versions (~40 bumps, including zeroize 1.9, rand 0.10.2, getrandom 0.4.3; also consolidates duplicate crate versions). - **Migrates the CLI off the base64 crate.** The CLI pinned base64 0.11 (2020); it now uses the library's own `utils::base64_encode/base64_decode` helpers (which use base64 0.22 internally) and the direct dependency is dropped. - **Upgrades uniffi from 0.31 to 0.32.** Bindings are generated at build time, so CI regenerates them with the matching uniffi version. One adaptation was needed: uniffi 0.32 maps borrowed `&[u8]` arguments to `java.nio.ByteBuffer` in Kotlin (zero-copy lowering), which would have broken every Kotlin consumer expecting `ByteArray`. The exported functions now take owned `Vec<u8>`, which keeps the Kotlin API on `ByteArray`; Swift (`Data`) and Python (`bytes`) are unaffected either way. ## Testing - `cargo clippy --workspace --all-targets -- -D warnings` — clean - `cargo fmt --all -- --check` — clean - `cargo deny check` — advisories ok, bans ok, licenses ok, sources ok - `cargo test --workspace` (excluding fuzz targets) — 134 passed, 0 failed
1 parent 6b02fac commit 05399a9

17 files changed

Lines changed: 479 additions & 596 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,19 @@ jobs:
189189
- uses: actions/checkout@v6
190190
- uses: ./.github/workflows/formatting/rust
191191

192+
#### DEPENDENCY AUDIT ####
193+
cargo_deny:
194+
runs-on: "ubuntu-22.04"
195+
196+
steps:
197+
- uses: actions/checkout@v6
198+
199+
- name: Install cargo-deny
200+
run: cargo install cargo-deny --locked
201+
202+
- name: Check dependencies
203+
run: cargo deny check
204+
192205
#### FUZZ TESTING ####
193206
quick_fuzz:
194207
runs-on: "ubuntu-22.04"

‎.github/workflows/formatting/rust/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ runs:
2020
- name: Check Clippy
2121
working-directory: ./
2222
shell: bash
23-
run: cargo clippy -- --D warnings
23+
run: cargo clippy --workspace --all-targets -- -D warnings

0 commit comments

Comments
 (0)