fix(e2e): disable self-registration in Cognito User Pools created by e2e tests#14898
Open
adrianjoshua-strutt wants to merge 1 commit into
Open
fix(e2e): disable self-registration in Cognito User Pools created by e2e tests#14898adrianjoshua-strutt wants to merge 1 commit into
adrianjoshua-strutt wants to merge 1 commit into
Conversation
…e2e tests All e2e test auth helper functions now write an override.ts file that sets AdminCreateUserConfig.AllowAdminCreateUserOnly = true on the User Pool. This addresses a security finding (Mirador: Cognito User Pool Self-Registration Enabled) by ensuring test pools do not allow public self-sign-up. All test user creation already uses AdminCreateUserCommand, so this change does not break any existing test functionality. The override is applied via the existing Amplify CLI override mechanism - a typed override.ts file is written to the auth resource directory after the CLI wizard completes. The buildOverrideDir function automatically picks this up during amplify push. Tests that set up their own custom overrides (e.g., auth_6.test.ts) will simply overwrite this file with their own content, so there is no conflict.
sarayev
approved these changes
May 26, 2026
Contributor
sarayev
left a comment
There was a problem hiding this comment.
Have we validated that none of these tests need self-registration be enabled (any tests that test signUp functionality)?
Member
Author
|
@sarayev Running the e2e tests should reveal this. But yes, some tests will need self registration. |
sarayev
approved these changes
May 26, 2026
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.
Description
All e2e test auth helper functions (
addAuthWithDefault,addAuthWithDefaultSocial,addAuthWithGroupTrigger, etc.) now write anoverride.tsfile that setsAdminCreateUserConfig.AllowAdminCreateUserOnly = trueon the User Pool.Motivation
This addresses a security finding (Mirador:
palisade.udd.cognito.userpool.selfregistration_enabled) where Cognito User Pools created by e2e/canary tests allow public self-sign-up. Since all test user creation already usesAdminCreateUserCommand(never the SignUp API), disabling self-registration does not break any existing test functionality.Changes
addAuthOverrideToDisableSelfSignup(cwd)helper function topackages/amplify-e2e-core/src/categories/auth.tsaddAuth*function that creates a new auth resourceoverride.tswritten to the auth resource directory)buildOverrideDirautomatically picks up the override duringamplify pushImpact
auth_6.test.ts) will simply overwrite this file with their own content — no conflictaddAuthOverrideToDisableSelfSignupfunction is exported so tests adding auth through non-standard mechanisms can also call it explicitlyTesting
auth.ts)amplify-e2e-core), so existing e2e test suites validate correctness