(aws_ses: EmailIdentity): (EmailIdentity grantSendEmail missing permission in case there is a configuration set defined)
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 74
Description
### Describe the bug
not sure if this can consider a bug. But when using EmailIdentity.grantSendEmail() in AWS CDK, the generated IAM policy does not include the ses:SendEmail and ses:SendRawEmail action with the required ConfigurationSetName condition, resulting in a failure to send emails when a configuration set is attached.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Library Version
_No response_
### Expected Behavior
Calling grantSendEmail() should grant permissions that allow sending emails with or without a configuration set. Specifically, it should include a policy allowing:
```json
{
"Action": "ses:SendEmail",
"Effect": "Allow",
"Resource": "*",
"Condition": {
"StringEquals": {
"ses:ConfigurationSetName": ""
}
}
}
```
### Current Behavior
only permission for declared entity
```json
{
"Action": [
"ses:SendEmail",
"ses:SendRawEmail"
],
"Resource": "arn:aws:ses:region:account:identity/example.com",
"Effect": "Allow"
}
```
### Reproduction Steps
```typescript
const mailConfigureSet = new ses.ConfigurationSet(this, 'mailConfigureSet', {
configurationSetName: `default-mail-configure-set`,
tlsPolicy: ses.ConfigurationSetTlsPolicy.REQUIRE,
});
const domainIdentity = new ses.EmailIdentity(this, 'domainIdentity', {
identity: 'domain.com',
configurationSet: mailConfigureSet,
mailFromDomain: 'domain.com',
});
domainIdentity.grantSendEmail(taskDef.taskRole);
```
### Possible Solution
_No response_
### Additional Information/Context
_No response_
### AWS CDK Library version (aws-cdk-lib)
2.188.0
### AWS CDK CLI version
2.1010.0
### Node.js Version
20
### OS
macOS
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start at EmailIdentity.grantSendEmail() and locate its existing implementation and tests. Reproduce the configuration-set case from the issue, then add coverage showing that sending works both with and without a configuration set and that the generated IAM policy includes the required condition; run the relevant SES tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100