mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 22:37:55 -05:00
* fix(cognito): return USER_ID_FOR_SRP in the SOFTWARE_TOKEN_MFA challenge The SOFTWARE_TOKEN_MFA challenge carried the canonical username under USERNAME. AWS returns it as USER_ID_FOR_SRP, the key clients read to build USERNAME and SECRET_HASH for the challenge response, so they could not answer the challenge. The challenge now carries USER_ID_FOR_SRP (the sub in a pool with UsernameAttributes) and FRIENDLY_DEVICE_NAME when one was set, matching the InitiateAuth API reference example. VerifySoftwareToken keeps the FriendlyDeviceName on the user and replaces it with each newly verified authenticator. Every flow that ends in SOFTWARE_TOKEN_MFA shares the same builder, so password, admin password, SRP, USER_AUTH, NEW_PASSWORD_REQUIRED and SELECT_MFA_TYPE all get the new parameters. MFA_SETUP is unchanged. Fixes #6074 * fix(cognito): reject an over-long FriendlyDeviceName in VerifySoftwareToken VerifySoftwareToken stored a FriendlyDeviceName of any length and later returned it in the SOFTWARE_TOKEN_MFA challenge. The service model caps the member at 131072 characters, and AWS rejects a longer value during request validation, before the code is checked. A longer name now fails with InvalidParameterException and the Smithy length-constraint message, before any session, token or code is looked at, so the user's authenticator, pending association and remaining attempts are left as they were. The length counts Unicode code points, as Smithy's length trait does, so a name of supplementary characters such as emoji is measured in characters rather than UTF-16 units. An absent or empty name is unchanged.