crates.io: We shouldn't let you add someone as an owner without their consent
This is a vector for abuse. We should require confirmation from the person being added before adding them, just like Github does for adding someone as an owner to a repo/team.
Implementation steps added by carols10cents:
The following tasks assume we’ll need a web UI for this in order to support users with arbitrarily old versions of cargo. I don’t think crates.io can have a state where this feature is “half on”, and even if we did, I think we’d have to stay in that state forever because people are always going to be using older versions of cargo. I’m open to hearing ideas on this issue though!
Crates.io Deployable chunk 1: Listing invitations
- (https://github.com/rust-lang/crates.io/pull/1040) Add a new table, crate_owner_invitations or something, that has columns:
- id of the user who ran
cargo owner --add - id of the user who is being added
- id of the crate involved
status of the invitiationthe only invitations in this table should be pending invitations; accepted invitations can be removed from this table and records added to crate_owners instead; declined invitations can be removed from this table.- when this request was created
- id of the user who ran
- Don’t add records to this table on a
cargo owner --addin this PR, add records to this table either manually withpsqlor in tests - (https://github.com/rust-lang/crates.io/pull/1040) Make an API route that can list all of the currently logged in user’s pending invitations
- (https://github.com/rust-lang/crates.io/pull/1057) Make a frontend page that calls that API route and displays the currently logged in user’s pending invitations (don’t link to this page from anywhere yet though)
Crates.io Deployable chunk 2: Accepting invitations
Still not creating records in crate_owner_invitations when cargo owner --add is run
- Make an API route for the currently logged in user to accept an invitation for a particular crate
- In a transaction:
- Add a record to the crate_owners table
- Remove the record from the crate_owner_invitations table
- In a transaction:
- On the frontend page that lists pending invitations, have a button that calls the accept API route (and displays success/error nicely, etc)
Crates.io Deployable chunk 3: Declining invitations
Still not creating records in crate_owner_invitations when cargo owner --add is run
- Make an API route for the currently logged in user to decline an invitation for a particular crate
- Delete the crate_owner_invitations record
- On the frontend page that lists pending invitations, have a button that calls the decline API route (and displays success/error nicely, etc)
Crates.io Deployable chunk 4: Requiring approval for ownership
Assume no changes to cargo, because we can’t change old cargo anyway!
- When someone runs
cargo owner --addfor a user (not a team):- Don’t create a record in crate_owners, instead create a record in crate_owner_invitations
- Hopefully send a response back from crates.io that tells the person running the command that the person being added should visit the list invitations page on crates.io to accept ownership (this might not be possible depending on what cargo does today though)
- To make the approval process discoverable as the person being added to the crate from old cargo, when someone runs
cargo publishon a crate where there’s a pending invitation to add them as an owner:- Fail the publish
- Return an error message from crates.io that directs the user that they have to accept the ownership invitation first by going to the list invitations page, and then they can try publishing again
Document this requirement in the cargo owner docs (which currently live in cargo’s repo)split into https://github.com/rust-lang/cargo/issues/4599Super nice would be some sort of notification that shows up anywhere on crates.io and lets you know you have outstanding ownership invitations and you should go to the invitation list page to approve or decline them (thank you for this idea @natboehm!!!)split into https://github.com/rust-lang/crates.io/issues/1116
Cargo deployable chunk 5: adding CLI support for accept/decline
split into https://github.com/rust-lang/cargo/issues/4600
Crates.io deployable chunk 6: UI for adding someone as an owner
split into https://github.com/rust-lang/crates.io/issues/1117
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 8
- Comments: 34 (33 by maintainers)
Commits related to this issue
- Merge #1045 1045: Sending an email to a user to confirm their email address r=carols10cents This PR addresses issue #808, allow editing your own email address. Following the discussion on the issue,... — committed to rust-lang/crates.io by bors-voyager[bot] 9 years ago
- Merge #1045 1045: Sending an email to a user to confirm their email address r=carols10cents This PR addresses issue #808, allow editing your own email address. Following the discussion on the issue,... — committed to rust-lang/crates.io by bors-voyager[bot] 9 years ago
- Merge #1045 1045: Sending an email to a user to confirm their email address r=carols10cents This PR addresses issue #808, allow editing your own email address. Following the discussion on the issue,... — committed to rust-lang/crates.io by bors-voyager[bot] 9 years ago
- Merge #1057 1057: Frontend page for listing pending owner invites r=carols10cents This implements the last checkbox in Deployable chunk 1: Listing invitations of issue #924. The frontend route creat... — committed to rust-lang/crates.io by bors-voyager[bot] 9 years ago
- Merge #1073 1073: Accept owner invites r=carols10cents This implements deployable chunk 2, accepting invitations of issue #924. I created a new route, `/me/crate_invitations/:crate_id` where a `PUT`... — committed to rust-lang/crates.io by bors-voyager[bot] 9 years ago
- Merge #1085 1085: Decline owner invites r=carols10cents This implements deployable chunk 3: declining invitations of issue #924. The api route for declining an invite is the same as for accepting an... — committed to rust-lang/crates.io by bors-voyager[bot] 9 years ago
- Auto merge of #4551 - natboehm:owner-invite-messages, r=alexcrichton Owner invite messages This PR addresses issue #4537, the plan for `cargo owner --add` requiring invitations in Cargo and the enco... — committed to rust-lang/cargo by bors 9 years ago
- Merge #1108 1108: Require owner approval r=carols10cents This PR addresses issue #924, adding owners with their consent, deployable chunk 4. It implements the Crates functionality necessary for Carg... — committed to rust-lang/crates.io by bors-voyager[bot] 9 years ago
Natalie is working on the email ish https://github.com/rust-lang/crates.io/issues/808 so emails are coming.
Invitations have been turned on!!! Thank you @sunjay and @natboehm!!
I think I’m going to split the remaining tasks into separate issues, since they’re mostly enhancements, the main request is “done” at this point.
As many as we can back to what was shipped with Rust 1.0, imo.
Thank you for your comments @sunjay!
Yes, I don’t think integrating acceptance with publish is necessary for an MVP of this feature.
Enterprises and linux distributions are not able to just upgrade whenever. So no, we can’t just make people upgrade in order to be able to accept/decline publishing invitations, unfortunately.
Since we can’t make people upgrade, the bare minimum implementation can be the web UI, and we can add the command line UI in the future.
Please open a new issue to discuss the more general things you have in mind-- I’d be interested to hear what you’re thinking about that couldn’t be implemented with the tests we have today that run in CI and why they’d have to run against the live site.
Thanks! I’ll admit I felt apprehensive about sharing the idea in the first place given that I’ve never even touched the code in this repo. I’m happy to hear you both liking it. Thanks for being open to that. 😊
I can help with the cargo integration stuff in about a week or so. What needs to be done from the crates.io side? I think much of your initial comments still apply just without the email stuff.
i am coming around to this CLI solution. it’s really elegant actually. i think people will eventually ask for email integration, but that gives us time to build all that shenanigans out. good call @sunjay !
I think I kinda just like @sunjay’s suggestion of hooking verification into the publish process? Absolutely no notification if you’ve been added as an owner (so there’s no way to even spam someone with ownership requests), and you can claim ownership the moment it’s actually relevant (when you need to publish).
We could do the same thing for owner --remove, in the case of an ownership transfer (and then it’s kinda like an atomic transfer op, which is neat).
Presumably, if you’re adding someone as an owner, you have another communication channel to inform them that you did this.