Repository navigation
fix(parser): accept real Cognito trigger events - #8762
Open
Manishram-ai wants to merge 1 commit into
Open
Manishram-ai wants to merge 1 commit into
Manishram-ai wants to merge 1 commit into
Conversation
The Cognito trigger models rejected events that Cognito sends in common flows: CUSTOM_CHALLENGE in the auth challenge session, the other documented trigger sources for pre sign-up, post confirmation and the custom email and SMS senders, and a null answerCorrect or clientId. This is the same fix as powertools-lambda-typescript#5777.
|
This branch has not been deployed
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.



Issue number:
closes #8761
Summary
Changes
CognitoChallengeResultModel.challengeNameacceptsCUSTOM_CHALLENGE, the first challenge type in the define auth challenge docs.triggerSourcedocumented for their trigger. The lists come from the trigger sources reference and the custom email and custom SMS sender pages. The trigger sources reference spells the SMS sourcesCustomSmsSender_*, but the custom SMS sender page and the API table useCustomSMSSender_*, which matches the existing literal, so I kept that spelling.answerCorrectin the verify auth challenge response andcallerContext.clientIdare optional, because Cognito sendsnullfor both. The function setsanswerCorrect, and admin API calls such asAdminConfirmSignUphave no client ID.CUSTOM_CHALLENGEin the define and create auth challenge sessions, and the twonullvalues. Each one starts from the existing fixture and changes one field.This is the same fix as aws-powertools/powertools-lambda-typescript#5777. Python's
sessionhas no minimum length and its custom sender models don't requireresponse, so those two parts of the TypeScript change weren't needed here.User experience
Today a custom auth flow can't be parsed past its first custom challenge, verify auth challenge events fail on
answerCorrect, and pre sign-up, post confirmation and custom sender events from admin, federated, forgot password and resend code flows fail with aValidationError. With this change they parse, and handlers can branch ontriggerSourceandchallengeNamethe way the Cognito docs describe.Verification
developand pass with this change.tests/unit/parser,tests/functional/parserandtests/unit/data_classes: 449 passed (Python 3.12).ruff format --checkandruff checkare clean on the changed files, and mypy shows no errors incognito.py.CUSTOM_CHALLENGEcome from the Cognito docs, and the twonullvalues come from the events captured from a live user pool in Bug: Cognito trigger schemas reject real events from common flows powertools-lambda-typescript#5770.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.