fix(cognito): reject undeclared custom user attributes (#7994) (#8124)

This commit is contained in:
jwoa95 authored and GitHub committed 2026-11-12 14:04:51 -04:00
1 parent 021e580a60
commit 5da8045bb2
9 files changed
+241 -6

No files matched your search

+9
View File
@@ -29,6 +29,15 @@ where `errorMessage` is taken verbatim from the function's error payload, as on
Sign-in by a disabled user fails with `NotAuthorizedException` (`User is disabled.`), as on AWS.
`AdminCreateUser`, `SignUp`, `AdminUpdateUserAttributes` and `UpdateUserAttributes` reject
`custom:` attributes that the user pool's schema does not declare with `InvalidParameterException`
and `Attribute does not exist in the schema.`. Declare custom attributes with `CreateUserPool`
or `AddCustomAttributes` before writing them. Validation runs before creating a user or changing
any attributes, so a rejected request does not save partial changes.
`NEW_PASSWORD_REQUIRED` responses, including custom SRP flows and administrative responses, also
validate custom attributes before changing the password or consuming the challenge session. An
undeclared attribute leaves both unchanged, so the client can correct the attributes and retry.
`CreateUserPool` supports overriding several values using user-pool tags **only** at creation time:
* `floci:override-id`, to pin the resulting `UserPool.Id`. Because a pinned id is caller-chosen it can be reused, which AWS never does. `DeleteUserPool` therefore deletes everything the pool owns (users, groups, app clients, resource servers, revoked token records and outstanding verification codes) so a pool recreated on the same id starts empty rather than inheriting the deleted pool's password hashes and client secrets.
* `floci:override-cognito-client-id`