Skip to content
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

chore(ci): add cargo vet #1098

Open
wants to merge 3 commits into
base: next
Choose a base branch
from

Conversation

MCJOHN974
Copy link

@MCJOHN974 MCJOHN974 commented Jan 23, 2025

Hi all, it's my first PR there!

Description

This PR adds cargo vet to CI and all necessary files to make it work. cargo vet is a tool, to check if crates you use in your project was audited, and will highlight if some was not. If some crate wasn't audited, you still can use it -- just audit it by yourself (put version you audited in supply-chain/audits.toml). This tool improves project security, forcing you to think a bit if you want to use an unaudited crate, and explicitly write that you want it.

Changes

  • this PR adds one more job to lint.yml which runs cargo vet.
  • this PR adds supply_chain/ directory, which is directory with cargo vet config files, files where you will put manually audited files, etc. Whole this directory was generated by running cargo vet init, so once you trust cargo vet creators and do cargo vet init by yourself you can be calm that all this a lot of lines are okish

Testing

This PR don't add any actual code, but a new CI job, so once CI is green it's fine. Also, you probably would want to run cargo vet init by yourself and see that supply_chain/ was generated by it.

Appendix

Of course it is up to maintainers to decide if you want add cargo vet or not, but I think it is always good to add because:

  • it don't stop you from anything, you still can use any crate you want
  • it pings you when some crate you use wasn't audited, which can improve security in some cases
  • from my experience majority of crates are audited, so most of the time you even don't remember that you have this in your CI

@MCJOHN974
Copy link
Author

I believe I don't have access to put no_changelog label, and I think this changes shouldn't be reflected in the changelog

@bobbinth bobbinth added the no changelog This PR does not require an entry in the `CHANGELOG.md` file label Jan 25, 2025
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Thank you for submitting this PR! We haven't used cargo vet before - so, will need to think about pros and cons here. I did leave a couple of questions in the inline comments which could help us understand this better.

Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm understanding this file correctly, we are basically saying that most dependencies are "exempted" from audits (i.e., they haven't been audited) - right?

If that's correct, the usefulness of this file seems limited because almost everything is treated as an exception. What are some ways to make the exemption list much smaller?

Copy link
Author

Choose a reason for hiding this comment

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

Hi @bobbinth and thank you for your review! You are correct, by default cargo vet do not mark any crate as "audited" by itself, and, yes, just "exempt" all crates you use when you do cargo vet init. To shrink size of "exempted" crates and actually do some auditing you can import audits from some repository you trust.

In 027f2fc I copied audit imports which are used in cargo-vet repo. This audits are from such parties as Google, Mozilla, Bytecode Alliance, etc. This moved 124 crates from "exempted" to "audited" stage.

However, there are still 382 "exempted" crates. To move them into "audited" stage we should audit it by ourselves or import some more audits from trusted parties

Copy link
Author

Choose a reason for hiding this comment

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

If you think you want to use cargo-vet in your repo, I can search for more audits from well known auditors and add them to this PR, trying to minimize amount of "exempted" crates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog This PR does not require an entry in the `CHANGELOG.md` file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants