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

Auth - verify password before enable MFA #3661

Closed
Mowinski opened this issue Jul 16, 2019 · 10 comments
Closed

Auth - verify password before enable MFA #3661

Mowinski opened this issue Jul 16, 2019 · 10 comments
Labels
Cognito Related to cognito issues feature-request Request a new feature Service Team Issues asked to the Service Team

Comments

@Mowinski
Copy link

** Which Category is your question related to? **
Auth and credentials

** What AWS Services are you utilizing? **
Cognito

** Provide additional details e.g. code snippets **
Hi!
I want to give my users new features - MFA Authorization.
If the user logs in to my page, in settings panel he/she is able to activate MFA.
I show popup information with wizard form.
The first step is verification user "what he/she knows" - so I ask about a password.
And there is a problem because amplify doesn't have any method to verify the password. I found a workaround but it is ugly. I just try to set a new password as old password and I check the status of this operation :)

My question, how can I verify user password in a prettier way?

@haverchuck
Copy link
Contributor

@Mowinski - By verify password, I assume you mean having the user enter their password after they've already authenticated. I am going to mark this issue as a feature request (unless my assumption is mistaken), since the Cognito service does not currently offer that functionality (I will verify that with them this week).

@haverchuck haverchuck added Cognito Related to cognito issues feature-request Request a new feature labels Jul 16, 2019
@haverchuck haverchuck added this to the Auth v2 milestone Jul 16, 2019
@malcomm
Copy link

malcomm commented Nov 6, 2020

+1 for this. My use case is to verify the user via a password challenge before they can sign a document. (this is also post-authentication).

@haverchuck - Any updates on this?

@jp-23
Copy link

jp-23 commented Jan 13, 2021

@haverchuck - any updates? I am looking to have the logged-in user enter their current password before performing certain actions such as updating their email address, or deleting their account.

@TheSimonLam
Copy link

@haverchuck Hey, I'm also trying to use this feature!
I'm trying to change a user's email after verifying it's their account by using a password.
Please let us know how it's going :)

@john-nexkey
Copy link

Currently vetting the workaround detailed by @Mowinski and wanted to document some findings as I am leaning toward this being a viable path for the use-case described by @jp-23. The workaround, for reference:

I found a workaround but it is ugly. I just try to set a new password as old password and I check the status of this operation :)

Although not ideal (clearly verifyPassword would be ideal), this approach and any perceived side-effects appear to be benign. Wondering if anyone else has found otherwise? I was hoping that setting the same password would yield an exception instead of a 200 response with a corresponding update to the Last Modified date, when in fact the change was inconsequential.

Another oddity is that the Audit Log shows password change events in a perpetual state of In Progress.

image

My tests, for reference:

// (bad,bad) password test (weak pw, for example foo)
=> Auth.changePassword(user, "foo", "foo");
// RESPONSE => 400 / {code: "InvalidParameterException", name: "InvalidParameterException", message: "2 validation errors detected: Value at 'previousPa…ember must have length greater than or equal to 6"}

// (bad,bad) password test (strong pw, for example yVGm=?Y)&-)[G3FU)
=> Auth.changePassword(user, "yVGm=?Y)&-)[G3FU", "yVGm=?Y)&-)[G3FU");
// RESPONSE => 400 / {code: "NotAuthorizedException", name: "NotAuthorizedException", message: "Incorrect username or password."}

// (good,good) password test
=> Auth.changePassword(user, "CORRECT_PASSWORD", "CORRECT_PASSWORD");
// RESPONSE => 200 / {}

// (good,"")
=> Auth.changePassword(user, "CORRECT_PASSWORD", ""); 
// RESPONSE => 400 / {code: "InvalidParameterException", name: "InvalidParameterException", message: "2 validation errors detected: Value at 'proposedPa…atisfy regular expression pattern: ^[\S]+.*[\S]+$"}

// (good,null)
=> Auth.changePassword(user, "CORRECT_PASSWORD", null);
// RESPONSE => 400 / {code: "InvalidParameterException", name: "InvalidParameterException", message: "1 validation error detected: Value at 'proposedPas…ed to satisfy constraint: Member must not be null"}

@codercodingthecode
Copy link

With 2FA usage increase, this should most definitely be a feature.

@gabrielmaldi
Copy link

gabrielmaldi commented Feb 8, 2022

It's very important to verify a user's password via a challenge before changing any MFA settings. Otherwise, if the user leaves his computer unattended for a moment, anyone can enable a new 2FA device and lock him out of his account.

@dilan-dio4
Copy link

@gabrielmaldi use the workaround described by @john-nexkey for now. It's pretty annoying that this feature isn't available at this point. The amplify team is obviously aware that this should be available, I imagine they see potential security flaws from client apps.

Also, manually trigging an MFA verification event should be implemented as well.

@elorzafe elorzafe added the Service Team Issues asked to the Service Team label Jun 21, 2022
@jp-23
Copy link

jp-23 commented Dec 28, 2022

@haverchuck - is there a repo for Cognito where I can submit this request? It sounds like the Cognito service first needs to provide this functionality right?

@cwomack
Copy link
Member

cwomack commented Mar 9, 2023

Closing this issue down as a duplicate of #1582. Please follow that issue for updates on progress for this feature. request.

@cwomack cwomack closed this as not planned Won't fix, can't repro, duplicate, stale Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cognito Related to cognito issues feature-request Request a new feature Service Team Issues asked to the Service Team
Projects
None yet
Development

No branches or pull requests