Skip to content

How would we handle a cargo left-pad incident? #10142

Description

@larsbergstrom

Earlier this week, the npm ecosystem got dropped on its head by the removal of left-pad from the main package repository, as fallout in a legal incident the author had with an otherwise unrelated package. The question I'd like to address in this issue is: what's our plan of action if servo gets left-pad'd? (and lest you think this is purely academic, there are crates like num_cpus that have a similar complexity & risk profile).

So, assume Servo has some dependencies on crates B_1...B_n, each of which depend on to_be_unpublished.

I think the long-term answer is pretty clear: B_1...B_n each update to a new fork of to_be_unpublished, rev their semver number, and publish to crates.io. The only wrinkle here is that if any of them transitively depend upon each other and to_be_unpublished is part of their public API, then they will have to make a breaking semver change and updates and publishes to crates.io will have to proceed in reverse topological order of the dependency graph. We deal with this scenario regularly in Servo when there's a breaking change deep in the dependency graph, and it's painful and slow (particularly if one of the B_i is undermaintained) but not unusual.

The bigger questions in my mind are:

  1. What do we do about reproducibility of old builds? If this crate has been unpublished from crates.io, bisecting just got broken.

Two alternatives used today are having our own internal mirror of crates.io that never unpublishes or vendoring copies of the entire dependency graph into a VCS system that is intended to be bisectable.

  1. What do we do in the immediate term when this removal drops the CI for everything in the dependency chain up to Servo on the floor and prevents us from landing any fixes until the "long-term answer" above is completed?

Top-level overrides pointed at the fork seem like the cleanest solution, though every single project in the dependency chain down to to_be_unpublished needs to make the addition. Assuming this lands, of course :-)

Otherwise, all I can really think of is using a .cargo/config paths override, which also would require introducing a git submodule. While Servo's toplevel has some wrapper scripts (mach) that handle dealing with submodules, most of the Rust/Cargo ecosystem probably will not.

This is obviously not incredibly urgent, but who knows when this will hit the Cargo ecosystem? Obviously, left-pad itself can't happen (only Alex can unpublish a crate, and AFAIK the policy is basically legal-reasons-only), but if somebody made godzilla-pad, Alex will definitely get an e-mail from TOHO :-)

cc @alexcrichton @wycats

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-buildRelated to or part of the build process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions