Skip to content

Conversation

@karakayasemi
Copy link
Contributor

@karakayasemi karakayasemi commented Jun 24, 2017

Description

There is an error in the logic of emitting preLogin signal in the LoginController. UserSession's login function is checking password and emitting preLogin signal, but loginController is either checking password before UserSession and returning view response without hook signal when failed login attempts.

With this change, unnecessary checkPassword functions are removed. Code simplified and now we are emitting preLogin hook also before failed login attempts.

Motivation and Context

preLogin hook is not emitting on failed login attempts. To resolve following issue
owncloud-archive/security#1

How Has This Been Tested?

Unit tests are working

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@DeepDiver1975 DeepDiver1975 self-requested a review June 25, 2017 19:13
@DeepDiver1975 DeepDiver1975 added this to the 10.1 milestone Jun 25, 2017
Copy link
Member

Choose a reason for hiding this comment

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

this totally removes the capability to login with the login name - right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If someone is trying to login with uid, getByEmail does not return anything. If a user's uid is the same as another user's email, it creates a problem.

Copy link
Member

Choose a reason for hiding this comment

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

so login is enough - we not longer need to call checkPassword? looks strange ....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

login is also using userManager's checkPassword inside of it with emitting hook signal before and after checkPassword. IMHO we can trust login.

@DeepDiver1975
Copy link
Member

an please squash your commits - thx

@DeepDiver1975
Copy link
Member

We miss a login failed hook - right?

@karakayasemi
Copy link
Contributor Author

we can add login failed hook to userSession's login method. However, I am not sure, where should we emit login failed signal also? For now, this change allows to use preLogin hook and it is enough to start security app. Should I work on login failed hook?
And also should I revert e-mail login part of the code? IMHO, it is simplifying logic and does not create any problem unless if a user's uid is the same as another user's email.

@DeepDiver1975
Copy link
Member

And also should I revert e-mail login part of the code? IMHO, it is simplifying logic and does not create any problem unless if a user's uid is the same as another user's email.

yes please - we shall keep the behavior

@DeepDiver1975
Copy link
Member

we can add login failed hook to userSession's login method. However, I am not sure, where should we emit login failed signal also? For now, this change allows to use preLogin hook and it is enough to start security app. Should I work on login failed hook?

we need that hook to log a failed login - or am I missing something?

@karakayasemi
Copy link
Contributor Author

we need that hook to log a failed login - or am I missing something?

IMHO, Login hook signal should emit from UserSession's login method. Since failed login check is done by userManager's checkPassword method in our current password correction logic, we can not emit any hook signal from userSessions login method in failed login attempts. Because of that, I removed checkPassword methods and used userSession's login function.
I will try to make changes you said in today.

Copy link
Member

Choose a reason for hiding this comment

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

shall we really expose the password?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought, maybe it can be useful for some warning like "it is your previous password".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I change password exposition? Still, I think it might be useful in fact.

Copy link
Member

Choose a reason for hiding this comment

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

I would not expose the password here - @Peter-Prochaska objections?

Copy link
Contributor

Choose a reason for hiding this comment

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

As a user, I might have accidentally put in a password for an account of mine on some other site, so would rather not have it displayed/logged... anywhere.

@karakayasemi
Copy link
Contributor Author

Now, failed login hook is exposing the only username.

@PVince81 PVince81 modified the milestones: development, 10.1 Jul 4, 2017
@PVince81
Copy link
Contributor

PVince81 commented Jul 4, 2017

@DeepDiver1975 is this now acceptable for merging ?

@PVince81
Copy link
Contributor

PVince81 commented Aug 9, 2017

This introduced a regression which was now fixed in #28450

@karakayasemi karakayasemi changed the title loginController now emitting preLogin hook before failed login attempts loginController now emitting failedLogin hook after failed login attempts Aug 15, 2017
@lock
Copy link

lock bot commented Aug 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants