[Proposal] Crate squatting on crates.io
Hey,
Disclaimer: I’d like to change from my habits of using the RFC process and try to gather opinion in here. Please tell me if you think it’s not appropriate.
I’d like to point out something I’ve been wondering for a few weeks now and since discussions I saw on (mostly) IRC. There exist some people who squate crates on crates.io. I won’t quote any name, a single search on google should give you such a list and we don’t really care: people do it. If you’re wondering, name squatting is the fact of uploading a crate with a manifest (Cargo.toml) without / with minimal code (typically a hello world), in order to get granted access to the crate name and upload some code afterwards, booking the name so that others cannot use it. I saw both people squatting names for obvious reasons (they have a good project on the go and a name that might be too general so others might use it, and hence they’re scared about that) but also for bad (some people just bomb the system and book very famous names without uploading code, like… NEVER).
So why am I ranting (again! :D)? Well, I think name squatting is a bad and toxic behavior. Some people (WindowsBunny, for instance) on IRC gave me good situations in which they actually need it, but that’s solely linked to the current implementation. In theory, they shouldn’t have to need it – in the case of WindowsBunny, they need to squat the win32 names so that they can provide incremental APIs development for the windows API, and that’s somehow legit.
So, there’re several solutions to this – for now, please only see them as thought experiments:
- Ban name squatting – i.e. ban people abusing it (WindowsBunny has a legit use of it, for instance). It’s a pro-active solution, so it might be a problem, because what should we do after the ban took place? Remove the crates?
- Require validation by administrators. Same as 1. but instead of being a pro-active, it’s pre-emptive (i.e. there’s no “we’ve found out”, you just cannot try). It also has issues because how do you know whether some code is “squatting” or “legit”? If administrators have to validate all crates, it won’t scale.
- Introduce namespacing. Namespacing gives you a unique identifier (your nickname? a word of your choice? your favorite meal?) under which all your crates will be folded. If you’re used to github… it’s kinda the same thing.
- Leave crates.io as it is now, but provide the possibility to contact an administrator to overtake a crate that’s been squatting without “legit” use-case and without having the author to agree – they will potentially never.
- Complementary (and I think this should be added whatever the other solutions): add the possibility to ask the community / administrator to explicitly disable a name. This “future-proof” yanking can be used for binaries. The best example is alacritty. The crate exists and is owned by the real author of alacritty but is squatting (it contains an Hello World). Try to
cargo install alacritty && cargo run alacritty– he does that to prevent a hacker to squat the name and provide a malicious binary, I guess. With this future-proof yanking feature,alacritty’s author could just ask for the removal of thealacrittycrate by adding it to a black list.cargocould see that and just provide a nice message to people trying to install that it’s a binary and that it cannot be installed via crates.io.
I have no idea which case is the best. Maybe you don’t care / don’t know about that problem but it happened to a lot of people. I also had issues when wanting to add crates of mine and the name I had in mine was being squatted for no reason.
What do you think?
Posted Sep 6, 2018, 11:49 PM UTC · edited