Add cargo-vet and cargo-deny supply-chain security#25
Open
jerrysxie wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces Rust supply-chain security checks by adding cargo-vet configuration (including imported third-party audits) and integrating cargo-deny/cargo-vet into GitHub Actions workflows to continuously validate dependencies in CI.
Changes:
- Add
cargo-vetconfiguration undersupply-chain/and set up audit imports. - Add GitHub Actions workflows to run
cargo veton PRs and post/update PR comments with results. - Integrate
cargo-denyconfiguration and a CI job to check advisories/licenses/bans/sources.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| supply-chain/imports.lock | Initializes cargo-vet import lock structure for upstream audit sources. |
| supply-chain/config.toml | Configures cargo-vet and defines upstream audit import URLs. |
| supply-chain/audits.toml | Adds the local audits file scaffold for cargo-vet. |
| .github/workflows/cargo-vet.yml | Adds CI job to install and run cargo-vet on PRs and upload PR metadata artifact. |
| .github/workflows/cargo-vet-pr-comment.yml | Adds workflow_run-based PR commenting/labeling based on cargo-vet outcomes. |
| deny.toml | Adds cargo-deny policy configuration for dependency checks. |
| .github/workflows/check.yml | Adds/updates CI to run cargo-deny as part of the main check workflow. |
Comment on lines
+37
to
+38
| - name: Invoke cargo-vet | ||
| run: cargo vet --locked |
| run: echo "${{ runner.tool_cache }}/cargo-vet/bin" >> $GITHUB_PATH | ||
|
|
||
| - name: Ensure that the tool cache is populated with the cargo-vet binary | ||
| run: cargo install --root ${{ runner.tool_cache }}/cargo-vet --version ${{ env.CARGO_VET_VERSION }} cargo-vet |
Comment on lines
+43
to
+49
| if: ${{ failure() }} || ${{ success() }} | ||
| run: | | ||
| mkdir -p ./pr | ||
| echo ${{ github.event.number }} > ./pr/NR | ||
| - uses: actions/upload-artifact@v4 | ||
| # Need to upload the artifact in both success and failure cases so comment can be updated in either case | ||
| if: ${{ failure() }} || ${{ success() }} |
| pull-requests: write | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
Comment on lines
+74
to
+96
| Details about the vetting process can be found in [supply-chain/README.md](../blob/main/supply-chain/README.md) | ||
|
|
||
| ## If the unvetted dependencies are not needed | ||
| Please modify Cargo.toml file to avoid including the dependencies. | ||
|
|
||
| ## If the unvetted dependencies are needed | ||
| Post a new comment with the questionnaire below to the PR to help the auditors vet the dependencies. | ||
| After the auditors have vetted the dependencies, the PR will need to be rebased to pick up the new audits and pass this check. | ||
|
|
||
| ### Copy and paste the questionnaire as a new comment and provide your answers: | ||
|
|
||
| **1. What crates (with version) need to be audited?** | ||
|
|
||
| **2. How many of the crates are version updates vs new dependencies?** | ||
|
|
||
| **3. To confirm none of the already included crates serve your needs, please provide a brief description of the purpose of the new crates.** | ||
|
|
||
| **4. Any extra notes to the auditors to help with their audits.** | ||
|
|
||
| <!-- | ||
| This comment is auto-generated by the cargo-vet workflow. | ||
| Please do not edit it directly. | ||
|
|
| url = "https://raw.githubusercontent.com/google/rust-crate-audits/main/audits.toml" | ||
|
|
||
| [imports.mozilla] | ||
| url = "https://raw.githubusercontent.com/mozilla/supply-chain/main/audits.toml" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds supply-chain security tooling based on the
embedded-rust-template:
supply-chain/) – dependency audit tracking with importsfrom ODP shared audits, Google, and Mozilla.
deny.toml) – license, advisory, ban, and source checks.cargo-vet.yml+ PR comment workflow, and thedenyjob incheck.yml.After merging, run
cargo vetlocally to populate exemptions for anyexisting unaudited dependencies: