-
Notifications
You must be signed in to change notification settings - Fork 324
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
Skip old_password validation when user has no usable password set #23
base: master
Are you sure you want to change the base?
Conversation
In case of social authentication, an unusable password is set. If settings have `OLD_PASSWORD_FIELD_ENABLED` then `old_password` is validated when the user changes the password. Since the user has not set any password in the past, the check for `old_password` should be skipped to change the password. The validation will work when the user has a password set.
I think allowing a social-auth user to change their password on an existing session makes the app less secure. For example, if a user creates their account with FB and 9 months later they want to set a new password for local login, they should be required to authenticate with FB again to set the password. |
There are two ways of changing the password.
In case 1: If the user is authenticated, they will use the change password endpoint, which is restricted to Since the user is authenticated, I believe it is safe to skip the old password check in this case. Because even user can skip old password validation by setting In case 2: Reset password will be done by email validation, where the old password is not required. This PR resolves the issue of case 1 where if the old password field is enabled and the user has signup using a social account, and the old password field is enabled in change password, the validation will be skipped first time when the user has an unusable password set. But will be validated next time. I hope, I'm able to describe the use case. |
The The old password validation skip will only work if |
That’s not good enough. Let’s say a token was compromised. The malicious user could access protected resources, but only up to a time limit. If you allow them to set the password without any re-auth you’re helping the malicious user. |
If that's the case then Also, If user has signup using FB, what are the other ways if they want to enable normal login by setting a password? Because, if This PR is just to let the user set password first time without needing an old password after they are authenticated and |
Thank you for creating this pull request. I think we can close it and make |
But what about If user has signup using FB. what are the other ways if they want to enable normal login by setting a password? User still won't be able to enable normal login. Also how the change password is secured if user set this config to |
The only secure way of doing this (that I can think of) is to re-auth in the set password flow. Facebook has some notes about this here. From the end user perspective it looks like this:
|
@iMerica This is cool too. But this has to be implemented in the Also this should be implemented in such a way that I mean there should be only one endpoint with fixed payload attributes and logic should be handled in the server. |
IMHO, Using the forgot password option is the best failproof way to set a password on an account which is created by using social authentication. |
1 question. changing password doesn't return a new token. Is this ok or should I refresh the token by calling this endpoint? |
In case of social authentication, an unusable password is set.
If settings have
OLD_PASSWORD_FIELD_ENABLED
thenold_password
is validated when the user changes the password.Since the user has not set any password in the past, the check for
old_password
should be skipped to change the password.The validation will work when the user has a password set.