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

[24.0] Disable password reset for deleted users [GCC2024_COFEST] #18459

Merged

Conversation

laperlej
Copy link
Collaborator

@laperlej laperlej commented Jun 28, 2024

Currently a deleted user can use the reset password functionality. Added a check in the send_reset_email function, deleted users will behave the same way as users that cannot be found. Returning the following error: "Failed to produce password reset token. User not found."

fixes #18195

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. Create a user
    2. Log in, log out as user
    3. Log in as admin, delete or delete+purge user
    4. Reset password as user

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@laperlej laperlej changed the title [24.0] Disable password reset for deleted users [24.0] Disable password reset for deleted users [GCC2024_COFEST] Jun 29, 2024
Copy link
Member

@jdavcs jdavcs left a comment

Choose a reason for hiding this comment

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

Thank you, @laperlej!

@martenson martenson merged commit 2540ab1 into galaxyproject:release_24.0 Jun 29, 2024
47 of 51 checks passed
self.user_manager.delete(user)
assert user.deleted is True
message = self.user_manager.send_reset_email(self.trans, {"email": user_email})
assert message == "Failed to produce password reset token. User not found."
Copy link
Member

Choose a reason for hiding this comment

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

Is this message getting out of the API ? We should never reveal whether or not a user exists at an instance, that's a security and privacy concern.

Copy link
Member

Choose a reason for hiding this comment

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

That message is returned when we fail to produce a password reset token.
Should we change it to just "Failed to produce password reset token"?

Copy link
Member

@mvdbeek mvdbeek Jul 1, 2024

Choose a reason for hiding this comment

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

I think we should return nothing, as Failed to produce password reset token is also an admission that we know about the user. (or not, in this case)

Copy link
Member

Choose a reason for hiding this comment

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

But we need to indicate to the user that they won't be able to reset their password (for whatever reason: either the account doesn't exist/is deleted etc.
Do we just pretend that a reset email is sent even though it isn't? Or maybe return this:
"Failed to submit email. Please contact the administrator: {util.unicodify(e)}" (from L610 in lib/galaxy/managers/users.py)

Copy link
Member

Choose a reason for hiding this comment

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

I don't agree, services generally don't ack that an account exists. Most services I know just say something along the lines of "If an account exists for this email address a confirmation email will be dispatched".

Copy link
Member

Choose a reason for hiding this comment

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

Do we just pretend that a reset email is sent even though it isn't?

That's what I meant to say here, my bad. So regardless of whether the email is sent or not, we just alert:
"If an account exists for this email address a confirmation email will be dispatched" (or something similar) once the user clicks reset password

image

Copy link
Member

Choose a reason for hiding this comment

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

@ahmedhamidawan yeah, that is the correct message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants