amplify-backend icon indicating copy to clipboard operation
amplify-backend copied to clipboard

Overriding auth attributes doesn't set the overridden values in `amplify_outputs.json`

Open nadetastic opened this issue 2 years ago • 1 comments

Environment information

System:
    OS: macOS 14.1.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 155.78 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    Yarn: Not Found
    npm: 10.2.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
    pnpm: Not Found
    bun: Not Found
    Watchman: Not Found
  npmPackages:
    @aws-amplify/backend: ^0.5.5 => 0.5.5 
    @aws-amplify/backend-cli: ^0.9.1 => 0.9.1 
    aws-amplify: ^6.0.5 => 6.0.5 
    aws-cdk: Not Found
    aws-cdk-lib: Not Found
    typescript: ^5.3.2 => 5.3.2

Description

In my backend.ts I have overridden my userpool password policy:

const { cfnUserPool } = backend.resources.auth.resources.cfnResources;
cfnUserPool.addPropertyOverride(
  "Policies.PasswordPolicy.RequireUppercase",
  false
);
cfnUserPool.addPropertyOverride(
  "Policies.PasswordPolicy.RequireSymbols",
  false
);

My userpool has taken the config: passwordpolicy

However amplifyconfiguration.json shows that Symbols and Uppercase is required, which forces the Authenitactor to validate as well:

  "aws_cognito_password_protection_settings": {
    "passwordPolicyMinLength": 8,
    "passwordPolicyCharacters": [
      "REQUIRES_NUMBERS",
      "REQUIRES_LOWERCASE",
      "REQUIRES_UPPERCASE", // should be false
      "REQUIRES_SYMBOLS" // should be false
    ]
  },

nadetastic avatar Dec 04 '23 02:12 nadetastic

Thanks for the suggestion! To do this we'd need to allow setting password policies in the defineAuth function rather than in overrides. Will follow up with the product team to see if this is something we want to add.

edwardfoyle avatar Dec 04 '23 20:12 edwardfoyle

@awsluja can this be closed now?

Amplifiyer avatar Jun 26 '24 15:06 Amplifiyer

This is fixed in https://github.com/aws-amplify/amplify-backend/pull/1483

awsluja avatar Jun 26 '24 16:06 awsluja