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

Add the ability to flag a user as deleted in GH #1586

Closed
wants to merge 4 commits into from

Conversation

sgrif
Copy link
Contributor

@sgrif sgrif commented Dec 27, 2018

When a user deletes their account in GitHub we don't receive any
notification that this has happened. If another user creates an account
with the same name, we will link to this new user on any crates owned
by the old user, which can make it appear that the new user is an owner
and lead to social engineering situations we don't want to permit.

The front-end is pretty coupled to the (false) concept that a user
always has a GH login, and that we can display it. Ideally I'd like to
move what we currently call "login" to the "id" field, but we have
at least 2 places today where we use the actual user id in the URL, so
we'll have to change those before we can make that happen. For now I've
just introduced a display_name field (which is confusingly named since
it's usually the same as login, not name, but I couldn't come up
with a better name).

When a user deletes their account (or renames it, we have no way of
knowing which one happened), we will no longer report their old github
name, and will instead report deleted_123 where 123 is our user ID
for them. This is then used in the users route to look them up, instead
of their old GH login, which may be reused by another user. Since we
don't necessarily want to allow crawling of user profiles, this can only
be used to access deleted accounts. Attempting to visit
/users/deleted_123 for a user ID that isn't deleted will 404.

Additionally, since we can't generally tell if a user deleted their
account or renamed it, logging back into crates.io (which will update
gh_login with the new value) automatically marks them as undeleted.

This isn't something we can reasonably automate detection of, but when
we do find out that it's happened, we can now manually flag a user. We
can detect this when a new user is created with the same gh_login as
an existing user, which will be handled in a followup PR.

Fixes #1585

When a user deletes their account in GitHub we don't receive any
notification that this has happened. If another user creates an account
with the same name, we will link to this new user on any crates owned
by the old user, which can make it appear that the new user is an owner
and lead to social engineering situations we don't want to permit.

The front-end is pretty coupled to the (false) concept that a user
always has a GH login, and that we can display it. Ideally I'd like to
move what we currently call "login" to the "id" field, but we have
at least 2 places today where we use the actual user id in the URL, so
we'll have to change those before we can make that happen. For now I've
just introduced a `display_name` field (which is confusingly named since
it's usually the same as `login`, not `name`, but I couldn't come up
with a better name).

When a user deletes their account (or renames it, we have no way of
knowing which one happened), we will no longer report their old github
name, and will instead report `deleted_123` where 123 is *our* user ID
for them. This is then used in the users route to look them up, instead
of their old GH login, which may be reused by another user. Since we
don't necessarily want to allow crawling of user profiles, this can only
be used to access deleted accounts. Attempting to visit
/users/deleted_123 for a user ID that isn't deleted will 404.

Additionally, since we can't generally tell if a user deleted their
account or renamed it, logging back into crates.io (which will update
gh_login with the new value) automatically marks them as undeleted.

This isn't something we can reasonably automate detection of, but when
we do find out that it's happened, we can now manually flag a user. We
*can* detect this when a new user is created with the same gh_login as
an existing user, which will be handled in a followup PR.

Fixes rust-lang#1585
@sgrif sgrif requested a review from jtgeibel December 27, 2018 14:43
@carols10cents
Copy link
Member

Say we find out that carols10cents has deleted her github account, and another user warols10cents has registered the carols10cents github username and logged in to crates.io. How does marking the original crates.io carols10cents' account as deleted change what someone browsing crates.io sees, exactly? How does marking the original carols10cents' account as deleted prevent warols10cents from performing social engineering attacks?

@sgrif
Copy link
Contributor Author

sgrif commented Jan 1, 2019 via email

@sgrif
Copy link
Contributor Author

sgrif commented Jan 11, 2019

@carols10cents Did you have any other concerns about this PR?

@bors
Copy link
Contributor

bors commented Mar 28, 2019

☔ The latest upstream changes (presumably #1699) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@smarnach smarnach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this manually using this branch. It works mostly as advertised, except for a small issue I commented on below.

Another nit is that the display name should also be used in the message that is shown when deleting an owner.

Apart from that, the code looks good to me.

@@ -21,7 +21,7 @@ export default Component.extend({
height: readOnly('width'),

alt: computed('user', function() {
return `${this.get('user.name')} (${this.get('user.login')})`;
return `${this.get('user.name')} (${this.get('user.display_name')})`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The /crates/:crate_name/owner_user does not return the display name for owners, so this will display "undefied" for all owners (except for the currently logged in one, since the /me endpoint does return the display name).

We will probably need to update the owner_user endpoint as well (which uses the EncodableOwner struct for serialization).

@smarnach
Copy link
Contributor

smarnach commented Aug 4, 2019

@sgrif In case it helps, I would be happy to implement the changes I proposed myself, provided that you think the proposal is reasonable – just let me know.

@sgrif
Copy link
Contributor Author

sgrif commented Aug 18, 2019

@smarnach Please do. If you'd like to rebase this as well that'd be great.

@jtgeibel
Copy link
Member

jtgeibel commented Feb 7, 2020

The last time I had a chance to look into this some, I believe I was able to convince myself that including the _ in deleted_ was sufficient to make sure we never conflict with a username on GitHub because _ is not allowed in a domain name. I don't think I found official documentation stating this, but it seems extremely unlikely to change.

The only suggestion I have, is that maybe we should use deleted_gh_ as the prefix, to future-proof for the possibility of additional authentication providers.

@Turbo87
Copy link
Member

Turbo87 commented Oct 14, 2020

since there has't been any movement on this PR for a while and it has plenty of conflicts by now I'll go ahead and close this. if we want to revive it we can always reopen it.

@Turbo87 Turbo87 closed this Oct 14, 2020
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

Successfully merging this pull request may close these issues.

We should have a way to mark that a user has been deleted
7 participants