-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add workflow for dependabot and cargo vet #537
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Runs cargo vet and cargo vet regenerate exemptions for Dependabot PRs | ||
name: Dependabot update cargo vet | ||
on: | ||
push: | ||
branches: | ||
- "dependabot/cargo/**" | ||
|
||
jobs: | ||
vet: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
|
||
env: | ||
CARGO_VET_VERSION: 0.8.0 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: ${{ runner.tool_cache }}/cargo-vet | ||
key: cargo-vet-bin-${{ env.CARGO_VET_VERSION }} | ||
|
||
- name: Add the tool cache directory to the search path | ||
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 | ||
|
||
- run: cargo vet | ||
continue-on-error: true | ||
|
||
# These all ask for input on the terminal to select the trusted criteria but take the default of `safe-to-deploy`. | ||
|
||
- run: cargo vet trust --all BurntSushi | ||
continue-on-error: true | ||
|
||
- run: cargo vet trust --all sunfishcode | ||
continue-on-error: true | ||
|
||
- run: cargo vet trust --all dtolnay | ||
continue-on-error: true | ||
|
||
- run: cargo vet trust --all cuviper | ||
continue-on-error: true | ||
|
||
- run: cargo vet trust --all Amanieu | ||
continue-on-error: true | ||
|
||
- run: cargo vet regenerate exemptions | ||
|
||
- name: commit and push | ||
shell: bash | ||
run: | | ||
if ! git diff --exit-code; then | ||
git config --global user.name 'github-actions[bot]' | ||
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | ||
git commit -am "[dependabot skip] Regenerate cargo vet" | ||
git push | ||
fi |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't feel comfortable us blindly doing this, for several reasons:
cargo-vet
's docs explicitly recommend doing this as a last resort:Even though this is probably the path of least resistance, following this approach will potentially reduce the possibility of allowing us to shrink our exemptions list, which is what I personally think we should be going after: every time a dependency is updated, we could (and probably should) check if audits or trust criteria for a particular crate has changed in the other supply chains that we import, for example, I noticed that we have exemptions for
clap
, but Wasmtime trusts it, is there a good reason for us not to trust it as well? This also seems to be a side effect of us relying mostly oncargo vet --locked
and perhaps not runningcargo vet
(without--locked
), which as per the docs, will fetch the imports and give suggestions, according to the imports, for example if I remove clap's exemption from our list and runcargo vet
I get the following suggestion to trustepage
clap
is just one example, but I think that if we don't keep regenerating the exemptions, we'd be able to get rid of other exemptions in the exemptions list by relying on all the delta audits that are already published.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove this line. I don't know how to automate adding additional trusted users given
cargo vet
doesn't appear to have a stable output format I can use a readily available parser on.Yeah I already run
cargo vet
without the--locked
parameter whenever I make a dependency change and add trusted publishers if our imports also trust the author.What happened in
clap
's case is it's owned by multiple users.epage
published a different version of the crate. So runningcargo vet trust --all epage
would not result in the crate being trusted. We have to runcargo vet trust clap epage
becauseepage
published a different version but we're vouching that we trust the version we're using (I'm not clear on why we specify the user in this case).Should we adopt the policy that if a publisher trusted by one of our imports has published a different version of the crate, we should trust the version of the crate we're using if it's been published by a different publisher who is not trusted by any of our imports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's right, if I trust
epage
and run cargo-vet after (having removed the exemption for clap) -- I still get a warning about our current version.I'd prefer if in this case we still require an audit/exemption since even though we assume that it's probably fine, we are trusting explicitly what a particular user publishes. Either that or updating to a dependency published by a trusted user. Like in the case of clap, if we update to a newer version, we can get rid of the exemption. (Sidenote: I'm curious why dependabot hasn't updated clap, we're in a old version)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed!
clap
is a transitive dependency used bycriterion
andstructop
.structopt
depends on version2.x
ofclap
which pins it to a2.x
version in our project.structop
is in maintenance mode so they're likely not updating their dependencies regularly. If we want to use a newer version ofclap
we should complete #321.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah that explains it -- I thought we had migrated.