mozilla / cargo-vet

supply-chain security for Rust
Apache License 2.0
621 stars 43 forks source link

Persistent aggregated repository of all audits in an organization (make `cargo vet aggregate` append only to `audits.toml`) #605

Open faern opened 3 months ago

faern commented 3 months ago

The recommended workflow for aggregation (supporting using cargo vet in multiple repositories) is to run the command cargo vet aggregate sources.list > audits.toml. This will wipe audits.toml and create a new audits file with the current content of all the sources. I find this impractical.

I have an organization with multiple repositories. Say we have org/product-a, org/product-b and org/cool-experiment. We then create an aggregated repository at org/supply-chain and aggregate the three. The team working on cool-experiment put a lot of time into auditing foo-compute and bar-visualize and add their audits to their local audits.toml. It gets aggregated, cool.

A while later this project is cancelled or sold to another company or just handed over to another OSS maintainer. We can now no longer guarantee the availability of org/cool-experiment/supply-chain/audits.toml. And even if it continues to exist under another organization, we no longer want to blindly trust new additions to this file! But we still want to keep on record that we have audited foo-compute and bar-visualize. Maybe org/product-a and/or org/product-b start using these dependencies, and they should of course not need to audit them again, since trusted people in the org already did. How to handle this?

  1. Repeat the audits whenever needed in another repository - A lot of wasted time, but feels like the only solution the tooling has first class support for?
  2. Manually copy the audits into product-a and product-b's own audits.toml. Causes repetition if it has to be done to both. Also, not handy if we don't use foo-compute today, but might in a year. When is it a good time to "vendor" this audit entry?
  3. Stop using the aggregate functionality and instead manually curate the shared org/supply-chain/audits.toml with all audits done throughout the organization. I currently find this the most solid approach. But since there is zero tooling support for it, it does not feel like how cargo vet is supposed to be used.

Is there a recommended workflow I'm missing here?

Same problem for third party audits

I have a very similar issue with imported third party audits. And I'll bring it up here since it's so related. This is related to #601. Let's say I'm responsible for security for cool-experiment at the org above. cool-experiment pulls in the log dependency. cargo vet screams at me/the developer. I go look in the global registry and I find that Mozilla made an audit for the version of log we want. I evaluate the note attached to the audit and the trustworthiness of the person who signed off on the audit. I decide to approve it. With the tooling available it would now end up in imports.lock. But with the downside the tool now pulls in everything from Mozilla as fully trusted. I instead vendor this audit to cool-experiment/supply-chain/audits.toml maybe. Doesn't matter for the upcoming problem.

A while later one of product-a or product-b want to pull in the log dependency. They now have the same problem again. They could resolve it way quicker if they could easily see that I already found a trustworthy audit for this crate, and they can rely on my judgement without having to evaluate third parties at all. But there is no tooling for this in cargo vet as far as I can see. Maybe I'm responsible for security for all three repos. But I can't remember every crate I ever audited. Do I need to scout around in all our repositories to see if I have already evaluated this dependency or not?

Best solution I have come up with so far

What I'd like is a persistent record of all third party audits someone in my organization has decided to approve. And one list of all audits performed within the organization. All projects within the organization can just trust these audits without looking twice. And the latter list (our own audits) can be published on the registry.

Currently the best way for this I have come up with is to set up a org/supply-chain repository like this:

And then configure all our products like this (in product-x/supply-chain/config.toml):

[imports.org-name]
url = "https://raw.githubusercontent.com/org/supply-chain/main/audits.toml"

[imports.org-name-third-party]
url = "https://raw.githubusercontent.com/org/supply-chain/main/audits-3rd-party.toml"