Skip to content

cargo vet#6974

Open
obrusvit wants to merge 5 commits into
mainfrom
obrusvit/cargo-vet
Open

cargo vet#6974
obrusvit wants to merge 5 commits into
mainfrom
obrusvit/cargo-vet

Conversation

@obrusvit
Copy link
Copy Markdown
Contributor

@obrusvit obrusvit commented May 22, 2026

This PR adds cargo-vet integration to track internal audits of 3rd party crates and to offshore some reviews to trusted parties.

See https://mozilla.github.io/cargo-vet/index.html

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Review Change Stack

Walkthrough

This PR adds cargo-vet supply-chain audit verification to the Trezor firmware Rust build pipeline. It introduces the cargo-vet tool to the development environment via shell.nix, creates a new make target (vet_rust) that runs cargo vet --locked, integrates this target as a verification step in the core unit test GitHub Actions workflow, and adds two configuration files: config.toml (defining cargo-vet version, import sources, and per-crate exemptions for 277 lines) and audits.toml (declaring safe-to-deploy audit entries for specific crate versions and trusted user policies).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description lacks substantive content beyond mentioning cargo-vet integration. It does not provide context, rationale, or implementation details required for proper review. Expand the description to explain why cargo-vet is needed, what problem it solves, the implementation approach (initial exemptions followed by imports), external audit sources used, and the vetting policy framework being established.
Title check ❓ Inconclusive The title 'cargo vet' is vague and does not clearly convey the specific purpose of the changes, which is to introduce cargo-vet tooling and supply-chain auditing. Use a more descriptive title such as 'Add cargo-vet supply-chain auditing tooling' to better summarize the primary objective.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch obrusvit/cargo-vet

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@trezor-bot trezor-bot Bot added this to Firmware May 22, 2026
@github-project-automation github-project-automation Bot moved this to 🔎 Needs review in Firmware May 22, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 22, 2026

en main(all)

model device_test click_test persistence_test
T2T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all) test(all) main(all)

Latest CI run: 26687998413

@mmilata
Copy link
Copy Markdown
Member

mmilata commented May 26, 2026

👍 to me personally this seems like a good direction to go.

I think the main consideration is how we set up the criteria. The default policy is to require safe-to-deploy ("no obvious backdoors even when processing untrusted input") for runtime and build dependencies, and safe-to-run ("no obvious backdoors") for dev dependencies, so I'd probably start with that. Works well with the imported reviews.

Then if we feel like it we can extend this with additional criteria like unsafe-reviewed/no-unsafe and crypto-reviewed/no-crypto, and require these by a policy. Not sure whether it would make sense to set different policies for different crates like firmware/kernel/secmon. See google's criteria for an example.

skimmed doesn't seem very useful, either we should turn it into safe-to-deploy, or add the skimmed crates to the list of exemptions and don't use it in newer reviews.

obrusvit added 5 commits May 30, 2026 17:43
- tool and CI setup
- no review imports yet
- vendored crates (pareen, qrcodegen, tjpdec) are treated as imported
  crates
- `cargo-vet` command should pass in this commit because all
  dependencies are exempted

[no changelog]
- picking Google, Mozilla and ZCash, we went down from 95 exempted
  crates to 77 exempted crates

Commands to achieve the results:
- cargo vet import google  https://raw.githubusercontent.com/google/supply-chain/main/audits.toml
- cargo vet import mozilla https://raw.githubusercontent.com/mozilla/supply-chain/main/audits.toml
- cargo vet import zcash   https://raw.githubusercontent.com/zcash/rust-ecosystem/main/supply-chain/audits.toml
- cargo vet
- cargo vet prune

[no changelog]
- adding also Bytecode Alliance and ISRG
- dropping exempted crates count to 66

[no changelog]
- cargo vet trust regex

[no changelog]
- ported the "Reviewed: Yes" rows from Notion

[no changelog]
@obrusvit obrusvit force-pushed the obrusvit/cargo-vet branch from f8a97bf to 2bbee66 Compare May 30, 2026 15:44
@obrusvit obrusvit marked this pull request as ready for review May 30, 2026 15:44
@obrusvit obrusvit requested a review from TychoVrahe as a code owner May 30, 2026 15:44
Copilot AI review requested due to automatic review settings May 30, 2026 15:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds cargo vet support for the Core Rust workspace so Rust dependency supply-chain checks can run in local Nix shells and CI.

Changes:

  • Adds cargo-vet to the Nix development environment.
  • Adds a make vet_rust target and wires it into the Core Rust CI job.
  • Introduces cargo-vet supply-chain configuration, local audits, imported audits lockfile, and exemptions.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
shell.nix Adds the cargo-vet tool to the development shell.
core/Makefile Adds a vet_rust target that runs cargo-vet for Core Rust dependencies.
core/embed/supply-chain/imports.lock Adds generated locked imported audit data for cargo-vet.
core/embed/supply-chain/config.toml Adds cargo-vet configuration, imported audit sources, policies, and exemptions.
core/embed/supply-chain/audits.toml Adds local audits and a trusted publisher entry.
.github/workflows/core.yml Runs the new cargo-vet target in the Core Rust CI job.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@obrusvit
Copy link
Copy Markdown
Contributor Author

@mmilata I reworked the PR to be more comprehensive. Go by commits to see the clear progress. I ported only the reviewed crates from our Notion table and I don't introduce any new criteria. I think it's a good enough starting point.

Currently, cargo vet gives the following result:

Vetting Succeeded (33 fully audited, 62 exempted)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🔎 Needs review

Development

Successfully merging this pull request may close these issues.

3 participants