@deployfoundation/foundation-deploy 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/app.js
CHANGED
|
@@ -2304,7 +2304,7 @@ class NewsletterStack extends cdk6.Stack {
|
|
|
2304
2304
|
this.campaignQueue.grantConsumeMessages(campaignRole);
|
|
2305
2305
|
this.campaignQueue.grantSendMessages(campaignRole);
|
|
2306
2306
|
this.tokenSigningSecret.grantRead(campaignRole);
|
|
2307
|
-
grantSesSend(campaignRole, identityArn, senderAddress);
|
|
2307
|
+
grantSesSend(campaignRole, identityArn, configurationSetArn, senderAddress);
|
|
2308
2308
|
const publicFunction = new lambda2.Function(this, "PublicFunction", {
|
|
2309
2309
|
runtime: lambda2.Runtime.NODEJS_22_X,
|
|
2310
2310
|
handler: "index.handler",
|
|
@@ -2631,13 +2631,18 @@ function lambdaRole(scope, id, description) {
|
|
|
2631
2631
|
]
|
|
2632
2632
|
});
|
|
2633
2633
|
}
|
|
2634
|
-
function grantSesSend(role, identityArn, senderAddress) {
|
|
2634
|
+
function grantSesSend(role, identityArn, configurationSetArn, senderAddress) {
|
|
2635
2635
|
role.addToPolicy(new iam7.PolicyStatement({
|
|
2636
2636
|
sid: "SendFromNewsletterIdentity",
|
|
2637
2637
|
actions: ["ses:SendEmail"],
|
|
2638
2638
|
resources: [identityArn],
|
|
2639
2639
|
conditions: { StringEquals: { "ses:FromAddress": senderAddress } }
|
|
2640
2640
|
}));
|
|
2641
|
+
role.addToPolicy(new iam7.PolicyStatement({
|
|
2642
|
+
sid: "SendThroughNewsletterConfigurationSet",
|
|
2643
|
+
actions: ["ses:SendEmail"],
|
|
2644
|
+
resources: [configurationSetArn]
|
|
2645
|
+
}));
|
|
2641
2646
|
}
|
|
2642
2647
|
function senderAddressFor(sender) {
|
|
2643
2648
|
const address = /<([^>]+)>$/.exec(sender)?.[1];
|
package/dist/src/index.js
CHANGED
package/package.json
CHANGED
|
@@ -198,7 +198,7 @@ export class NewsletterStack extends cdk.Stack {
|
|
|
198
198
|
this.campaignQueue.grantConsumeMessages(campaignRole);
|
|
199
199
|
this.campaignQueue.grantSendMessages(campaignRole);
|
|
200
200
|
this.tokenSigningSecret.grantRead(campaignRole);
|
|
201
|
-
grantSesSend(campaignRole, identityArn, senderAddress);
|
|
201
|
+
grantSesSend(campaignRole, identityArn, configurationSetArn, senderAddress);
|
|
202
202
|
|
|
203
203
|
const publicFunction = new lambda.Function(this, "PublicFunction", {
|
|
204
204
|
runtime: lambda.Runtime.NODEJS_22_X,
|
|
@@ -554,7 +554,12 @@ function lambdaRole(scope: Construct, id: string, description: string): iam.Role
|
|
|
554
554
|
});
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
-
function grantSesSend(
|
|
557
|
+
function grantSesSend(
|
|
558
|
+
role: iam.Role,
|
|
559
|
+
identityArn: string,
|
|
560
|
+
configurationSetArn: string,
|
|
561
|
+
senderAddress: string,
|
|
562
|
+
): void {
|
|
558
563
|
role.addToPolicy(
|
|
559
564
|
new iam.PolicyStatement({
|
|
560
565
|
sid: "SendFromNewsletterIdentity",
|
|
@@ -563,6 +568,18 @@ function grantSesSend(role: iam.Role, identityArn: string, senderAddress: string
|
|
|
563
568
|
conditions: { StringEquals: { "ses:FromAddress": senderAddress } },
|
|
564
569
|
}),
|
|
565
570
|
);
|
|
571
|
+
// SES v2 authorizes a send against EVERY resource it names, and each send
|
|
572
|
+
// names the configuration set (that is how delivery, bounce and complaint
|
|
573
|
+
// events reach the suppression queue). Without this, every confirmation and
|
|
574
|
+
// campaign send was an AccessDeniedException. The sender stays pinned by the
|
|
575
|
+
// identity statement above.
|
|
576
|
+
role.addToPolicy(
|
|
577
|
+
new iam.PolicyStatement({
|
|
578
|
+
sid: "SendThroughNewsletterConfigurationSet",
|
|
579
|
+
actions: ["ses:SendEmail"],
|
|
580
|
+
resources: [configurationSetArn],
|
|
581
|
+
}),
|
|
582
|
+
);
|
|
566
583
|
}
|
|
567
584
|
|
|
568
585
|
function senderAddressFor(sender: string): string {
|