Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cognito/ses: "Provided From email address is invalid" when using email address for from_name #18903

Closed
ekeyser opened this issue Feb 9, 2022 · 1 comment · Fixed by #23227
Labels
@aws-cdk/aws-cognito Related to Amazon Cognito bug This issue is a bug. p1

Comments

@ekeyser
Copy link

ekeyser commented Feb 9, 2022

What is the problem?

specifying an email address for a from_name parameter results in a broken Cfn parameter for "From".

Reproduction Steps

the following python code (but specific to cognito construct):

user_pool = cognito.UserPool(
            self,
           .
           .
           .
            email=cognito.UserPoolEmail.with_ses(
                ses_region="us-east-1",
                from_email="someemail@somedomain.edu",
                from_name="someemail@somedomain.edu",
                reply_to="someemail@somedomain.edu",
            ),

This results in the below behavior.

What did you expect to happen?

Simply use the email address as the name.

What actually happened?

resulted in the following Cfn template output:

"EmailConfiguration": {
          "EmailSendingAccount": "DEVELOPER",
          "From": "someemailaddr@somedomain.edu <someemailaddr",
          "ReplyToEmailAddress": "someemailaddr@somedomain.edu",

As you can see the "From" param is malformed likely due to a string manipulation/prune on the from_name cdk value.

CDK CLI Version

1.142.0

Framework Version

No response

Node.js Version

v14.18.1

OS

Linux/Ubuntu 20.04

Language

Python

Language Version

3.8.10

Other information

Now, I know what you're going to say, "Don't put an email address where a name is expected", to which I will direct your attn to exhibit 1: in the AWS console if you navigate to the Messaging tab of the cognito user pool, the FROM sender name clearly shows an email address when configured manually. So, regardless of how strict the heuristics are for CDK/Cfn, they should align with what is allowable in the console. :-)

@ekeyser ekeyser added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 9, 2022
@github-actions github-actions bot added the @aws-cdk/aws-cognito Related to Amazon Cognito label Feb 9, 2022
@NGL321 NGL321 added p1 and removed needs-triage This issue or PR still needs to be triaged. labels Feb 14, 2022
@mergify mergify bot closed this as completed in #23227 Dec 19, 2022
mergify bot pushed a commit that referenced this issue Dec 19, 2022
)

Closes #18903

When `fromName` of `UserPoolEmail.withSES()` does not comply RFC 5322 atom or quoted-string, it will be quoted or mime-encoded.

For example:
|`fromName`|Template|Description|
|-|-|-|
|`'simple atom'`|`"simple atom <address@example.com>"`|as is|
|`'"quoted string"'`|`"\"quoted string\" <address@example.com>"`|as is|
|`'あいう'`|`"=?UTF-8?B?44GC44GE44GG?= <address@example.com>"`|mime encode (RFC 2047)|
|`'name@company'`|`"\"name@company\" <address@example.com>"`|make quoted-string|

For details, see [RFC 5322 Section 3.4](https://www.rfc-editor.org/rfc/rfc5322#section-3.4) and [RFC 2047](https://www.rfc-editor.org/rfc/rfc2047)

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Construct Runtime Dependencies:

* [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

brennanho pushed a commit to brennanho/aws-cdk that referenced this issue Jan 20, 2023
…#23227)

Closes aws#18903

When `fromName` of `UserPoolEmail.withSES()` does not comply RFC 5322 atom or quoted-string, it will be quoted or mime-encoded.

For example:
|`fromName`|Template|Description|
|-|-|-|
|`'simple atom'`|`"simple atom <address@example.com>"`|as is|
|`'"quoted string"'`|`"\"quoted string\" <address@example.com>"`|as is|
|`'あいう'`|`"=?UTF-8?B?44GC44GE44GG?= <address@example.com>"`|mime encode (RFC 2047)|
|`'name@company'`|`"\"name@company\" <address@example.com>"`|make quoted-string|

For details, see [RFC 5322 Section 3.4](https://www.rfc-editor.org/rfc/rfc5322#section-3.4) and [RFC 2047](https://www.rfc-editor.org/rfc/rfc2047)

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Construct Runtime Dependencies:

* [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
brennanho pushed a commit to brennanho/aws-cdk that referenced this issue Feb 22, 2023
…#23227)

Closes aws#18903

When `fromName` of `UserPoolEmail.withSES()` does not comply RFC 5322 atom or quoted-string, it will be quoted or mime-encoded.

For example:
|`fromName`|Template|Description|
|-|-|-|
|`'simple atom'`|`"simple atom <address@example.com>"`|as is|
|`'"quoted string"'`|`"\"quoted string\" <address@example.com>"`|as is|
|`'あいう'`|`"=?UTF-8?B?44GC44GE44GG?= <address@example.com>"`|mime encode (RFC 2047)|
|`'name@company'`|`"\"name@company\" <address@example.com>"`|make quoted-string|

For details, see [RFC 5322 Section 3.4](https://www.rfc-editor.org/rfc/rfc5322#section-3.4) and [RFC 2047](https://www.rfc-editor.org/rfc/rfc2047)

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Construct Runtime Dependencies:

* [ ] This PR adds new construct runtime dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-construct-runtime-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cognito Related to Amazon Cognito bug This issue is a bug. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants