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

fix(passcodes): user enumeration on invalid passcodes #3054

Closed
wants to merge 3 commits into from

Conversation

coldlink
Copy link
Member

@coldlink coldlink commented Feb 5, 2025

Okta will only allow a maximum of 5 attempts for passcodes before giving an errorm where the user will be redirected to the sign in page/

However if a user doesn’t exist in Okta, we fake this functionality to always show an passcode error, however we don’t keep track of the number of attempts.

This means that you can work out if an account exists or not, by attempting to submit a passcode more that 5 times on the sign in/password reset flow. If you’re able to submit the code more than 5 times, then the user doesn’t exist in Okta, if you’re not able to submit more than 5 times then the user exists in Okta.

Essentially we need to replicate this behaviour for user’s who don’t exist in Okta, by keeping track of how many times the code was submitted.

This commit does this by adding and incrementing a passcodeFailedCount on the EncryptedState cookie. Then when we reach 5 attempts (or more), we redirect to the expired page, in order to replicate this behaviour for all scenarios.

What does this change?

How to test

How can we measure success?

Have we considered potential risks?

Images

Accessibility

Okta will only allow a maximum of 5 attempts for passcodes before giving an errorm where the user will be redirected to the sign in page/

However if a user doesn’t exist in Okta, we fake this functionality to always show an passcode error, however we don’t keep track of the number of attempts.

This means that you can work out if an account exists or not, by attempting to submit a passcode more that 5 times on the sign in/password reset flow. If you’re able to submit the code more than 5 times, then the user doesn’t exist in Okta, if you’re not able to submit more than 5 times then the user exists in Okta.

Essentially we need to replicate this behaviour for user’s who don’t exist in Okta, by keeping track of how many times the code was submitted.

This commit does this by adding and incrementing a `passcodeFailedCount` on the `EncryptedState` cookie. Then when we reach 5 attempts (or more), we redirect to the expired page, in order to replicate this behaviour for all scenarios.
On a redirect to an expired page we should clear the encrypted state cookie from all IDX API values in order to reset it.
…reset-password

Previously when the passcode had expired, or had been incorrect multiple times, we'd redirect users to the older `/welcome/expired` page for create account (register), and `/reset-password/expired` for reset password.

The problem with these pages is that the copy and UX was more suited to when a link rather than code had expired/invalidated.

Instead we now take the same approach as taken on the Sign In page, where we redirect back to the initial page the user took the action on, but show an error with context saying their code had expired, and to receive a new one instead.

We also add cypress tests to cover this behaviour as they previously didn't exist!
@coldlink coldlink requested review from a team and removed request for a team February 5, 2025 10:28
@coldlink
Copy link
Member Author

coldlink commented Feb 6, 2025

Replaced by #3056 and #3057

@coldlink coldlink closed this Feb 6, 2025
@coldlink coldlink deleted the mm/passcode-user-enumeration branch February 6, 2025 16:01
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.

1 participant