mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
* feat(cognito): hand email codes to the CustomEmailSender trigger
* test(cognito): decrypt CustomEmailSender codes with the AWS Encryption SDK
* docs(cognito): document the CustomEmailSender trigger
* fix(cognito): fail a CustomEmailSender delivery as Cognito does
Measured on Cognito (eu-west-1, 2026-10-16), with the events a real sender
received:
- CreateUserPool and UpdateUserPool refuse a custom sender trigger without
a KMSKeyID ("KMSKeyId parameter is required when Custom SMS/Email Lambda
trigger is used."), and CreateUserPool a key that does not exist
("Encountered error when CreateGrant was attempted on the input KMS key -
Key '<id>' does not exist"), both InvalidParameterException.
- A disabled key fails the request with CodeDeliveryFailureException
"Caller needs to enable the configured KMS Key", a key pending deletion
with "Unable to encrypt CustomEmailSender/CustomSMSSender code using the
configured KMS Key". The sign-up is kept, unlike a failed SES delivery,
and InitiateAuth answers the same error rather than InternalErrorException.
- A function that is gone, or that Cognito may not invoke, answers
UnexpectedLambdaException "CustomEmailSender invocation failed due to
error AccessDeniedException."
- request.clientMetadata is null for every source, InitiateAuth's
ClientMetadata included, so the parameter that carried it is gone.
The branch also follows main since it was written: CognitoService takes
enforceTokenValidityLimits, and signUp ValidationData and ClientMetadata.
* fix(cognito): withdraw a code the CustomEmailSender could not take
Review of #6031: when the handover failed, the code issued for it stayed
live in SignUp, ForgotPassword and both attribute flows, so asking for a
code again within 30 seconds answered LimitExceededException. Measured
on Cognito (eu-west-1): it hands out a code again at once, on a healthy
pool and once a key that could not encrypt is enabled again, for
ResendConfirmationCode and ForgotPassword alike.
sendThroughCustomEmailSender now withdraws the code before it fails, for
every flow, and the two catches that withdrew it by hand (resend and the
sign-in OTP) leave that to it.
* fix(cognito): hand the CustomEmailSender the request's ClientMetadata
Review of #6031: the developer guide lists ClientMetadata for the
sign-up, forgot-password and sign-in sources, and the branch passed null
for every one on the strength of InitiateAuth alone. Measured on Cognito
(eu-west-1): SignUp, ResendConfirmationCode, ForgotPassword,
GetUserAttributeVerificationCode and UpdateUserAttributes each hand the
function the request's ClientMetadata; only the sign-in code's event has
none, even when InitiateAuth sends one. A request without ClientMetadata
gives null, as measured before.
ResendConfirmationCode, ForgotPassword and the two attribute calls now
take the request's ClientMetadata through the service, with overloads
that keep their previous signatures. resolveTriggerArn's custom sender
branch gets its braces.
---------
Co-authored-by: outof-place <contact@outofplace.space>
8 lines
134 B
Plaintext
8 lines
134 B
Plaintext
boto3==1.43.108
|
|
botocore==1.43.108
|
|
cryptography>=42.0.0
|
|
aws-encryption-sdk==4.0.7
|
|
pytest>=8.0.0
|
|
pytest-timeout>=2.3.0
|
|
cramjam==2.12.1
|