mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
* fix(cognito): run the PreSignUp trigger on AdminCreateUser AWS invokes the pre sign-up trigger when AdminCreateUser creates a user, with triggerSource PreSignUp_AdminCreateUser, the request's ValidationData and ClientMetadata, and ignores the response's autoConfirmUser, autoVerifyEmail and autoVerifyPhone. A trigger error refuses the user. The trigger runs before anything is stored, so a refused ForceAliasCreation request no longer moves the alias off the existing user. * fix(cognito): invoke PreSignUp outside the user lock on AdminCreateUser AdminCreateUser held the lock stripe of the requested username while the pre sign-up trigger ran. A function that called back into the pool for an identifier on the same stripe, such as AdminCreateUser for the same username, waited for that lock until the invocation timed out. The trigger now runs with no lock held. A taken username or alias is still refused before the trigger is invoked, and the checks run again under the lock once it accepts, so a user created while the trigger ran still fails the request with UsernameExistsException. With ForceAliasCreation, the alias holder was read before the trigger and written back after it, which could undo a change made to the holder in the meantime or restore a deleted holder. The holder is now looked up under the lock after the trigger, just before its alias is moved. * fix(cognito): run PreSignUp once per in-flight AdminCreateUser username With the pre sign-up trigger running outside the user lock, two overlapping AdminCreateUser requests for the same free username could both pass the existence check and both invoke the trigger. The later one was then refused under the lock after its function had already run, or failed with the function's own error instead of UsernameExistsException. AdminCreateUser now claims the username before checking it and gives the claim up once the user is stored or the request fails. An overlapping request for the same username, including one the function makes for the username it was given, is refused with UsernameExistsException before it invokes the trigger.