rust-lang / crates-io-cargo-teams

the home of the crates io team
5 stars 11 forks source link

Tracking issue: yank #9

Open nrc opened 5 years ago

nrc commented 5 years ago

Background

crates.io does not have any way to remove a crate from the registry. Instead, cargo yank allows a crate owner to mark a version of a crate as yanked. Such crate versions are not shown on the web page of crates.io and cannot be added to a project, however, if a yanked version of a crate is in a Cargo.lock file, it can still be downloaded and used.

Versions of a crates are marked as yanked in the registry, and the registry API includes ways to yank a crate version and inspect its yanked status. How a yanked crate is used is implemented in Cargo. That means a determined user can get around the restrictions by synthesizing a lock file or by changing the Cargo source.

The goal of yanking (as opposed to removal) is to allow authors to withdraw a crate (for example due to a security issue, without breaking downstream users. The arrangement with building reflects this - it is assumed that downstream binaries will commit a lock file and thus still be buildable even after a version is yanked. However, adding the yanked crate or building a library with such a dependency is not possible.

There is an intrinsic tension with yank: on one hand we want to make it difficult for users to use a yanked crate (in particular if a crate is yanked for a security concern), however, we want to avoid breaking downstream (binary) users if they are relying on a yanked crate.

Problems

Possible solutions