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

Adding new crates to a workspace and forgetting audit-as-crates-io #604

Open
alexcrichton opened this issue Apr 2, 2024 · 1 comment
Open

Comments

@alexcrichton
Copy link

Over in Wasmtime I've noticed some odd behavior around cargo vet which I think can probably be attributed to forgetting to add new entries with audit-as-crates-io. I am not 100% certain of this sequence of events, but I think the rough shape of what we're seeing is:

  1. Add a new crate to the workspace, for example in our case let's say wasmtime-foo. This crate isn't published on crates.io yet. No cargo-vet changes are recorded for this crate.
  2. Eventually a release branch is created for, say release-20.0.0. This means that on the release branch wasmtime-foo is at 20.0.0 and on main it's 21.0.0
  3. The release-20.0.0 branch is released, meaning that crates.io now has 20.0.0.
  • Here if you have a fresh install and run cargo vet on main it appears that cargo vet well generate an error recommending audit-as-crates-io
  • If you have a fresh install and run cargo vet --locked on main then this succeeds
  • If you have a "dirty install" where you were previously doing cargo vet things locally, this does not error out on main. Removing ~/.cache/cargo-vet causes the error to show up.
  1. CI continues to pass on main and release-20.0.0 because cargo vet --locked works.

We appear to be wedging ourself into a state where CI is always passing at all times but in the future cargo vet fails by default locally. This failure doesn't happen for everyone as it appears to be dependent on ~/.cache/cargo-vet state as well. I apologize in that I have not done a precise reproduction of all the steps above because it seems to require interaction with publishing crates on crates.io. I'm trying to describe various failures and confusing behaviors we've seen in Wasmtime CI and locally as best I can, but I can also try to provide more information if that'd help.

@mystor
Copy link
Collaborator

mystor commented Apr 22, 2024

The caching of the non-published status of crates is somewhat intentional to avoid spamming crates.io with requests every time a cargo vet command is run, which unfortunately led to this situation. We did set the expiry time for nonexistant crate checks fairly long (60 days) which perhaps was a mistake. I think it could make sense to shorten it, but that still leads to this problem just with a shorter timeframe before things start working as expected.

I don't think there's a great way for us to immediately detect that a crate has been published without checking crates.io every time unfortunately, unless cargo leaves some kind of paper trail for us to detect. It might be possible to notice the crate in the local cargo cache, but we've been avoiding depending on that since there are now multiple formats and such with the https crates.io registry changes. Perhaps the new setup is now stable enough that it's OK to give that a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants