fix(cognito): validate AdminCreateUser TemporaryPassword against pool policy#1794
Merged
Merged
Conversation
… policy SignUp and AdminSetUserPassword run validate_password against the pool's password policy, but AdminCreateUser stored the supplied TemporaryPassword unchecked. A pool requiring (say) MinimumLength=8 + uppercase accepted AdminCreateUser(TemporaryPassword="weak"), bypassing the policy for admin-provisioned users -- AWS returns InvalidPasswordException. Validate a supplied TemporaryPassword against the pool's password policy before creating the user (omitting it is fine; Cognito generates one). - crates/fakecloud-cognito/src/service/users.rs - test: admin_create_user_validates_temporary_password_against_policy
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SignUpandAdminSetUserPasswordrunvalidate_passwordagainst the pool's password policy, butAdminCreateUserstored the suppliedTemporaryPasswordunchecked. A pool requiring e.g.MinimumLength=8+ uppercase acceptedAdminCreateUser(TemporaryPassword="weak"), bypassing the policy for admin-provisioned users — AWS returnsInvalidPasswordException.Fix: validate a supplied
TemporaryPasswordagainst the pool's password policy before creating the user. Omitting it stays valid (Cognito generates one).Found by the 2026-06-20 bug-hunt audit (finding 1.12).
Test plan
admin_create_user_validates_temporary_password_against_policy— a pool withMinimumLength=8/RequireUppercaserejects a weakTemporaryPasswordwithInvalidPasswordExceptionand accepts a conforming one.cargo clippy -p fakecloud-cognito --all-targets -- -D warningsclean.Summary by cubic
Validate
AdminCreateUserTemporaryPasswordagainst the user pool password policy to prevent bypassing requirements and match AWS behavior (returnsInvalidPasswordExceptionon weak passwords).TemporaryPasswordis provided; omission still allowed (Cognito generates one).fakecloud-cognito.Written for commit bd3a285. Summary will update on new commits.