fix(cognito): accept a CUSTOM_CHALLENGE answer to a challenge DefineAuthChallenge named (#10269)

RespondToAuthChallenge takes only ChallengeNameType values, so a challenge DefineAuthChallenge names otherwise, such as MY_CHALLENGE, is answered with CUSTOM_CHALLENGE, as on AWS. The custom session check compared the answer with the trigger's name and refused it with Invalid session for the user. Compare it with the name the challenge is answered as; the responses and the session history keep the trigger's name.

Closes #7678
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-12-05 19:21:18 -04:00
1 parent 9975577635
commit a9d3f1ecff
3 files changed
+72 -2

No files matched your search

+3 -1
View File
@@ -607,7 +607,9 @@ DefineAuthChallenge history with `SRP_A=true`, issues a real `PASSWORD_VERIFIER`
and verifies the SRP proof before returning to the trigger's custom challenges. Temporary-password
users complete `NEW_PASSWORD_REQUIRED` within the same custom sequence. Each response must match
the issued session's client, user and challenge; sessions are consumed once. Plain custom
challenges remain supported. `RESET_REQUIRED` still requires password recovery first because
challenges remain supported. A challenge name DefineAuthChallenge returns outside the
`ChallengeNameType` values, such as `MY_CHALLENGE`, is answered with `CUSTOM_CHALLENGE`, as on AWS;
the challenge responses and the trigger's session history keep the trigger's name. `RESET_REQUIRED` still requires password recovery first because
Floci clears the SRP verifier when an administrator resets the password.
See [AWS's custom SRP sequence](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-challenge.html#user-pool-lambda-challenge-srp-authentication).