fix(ses): keep MailFromAttributes block when MAIL FROM is unconfigured (#1310)

GetEmailIdentity dropped the entire MailFromAttributes block for an
identity with no MAIL FROM domain configured, so an SDK caller saw
mailFromAttributes() == null on the emulator but non-null on real AWS.
AWS keeps the block carrying BehaviorOnMxFailure and omits only the
inner MailFromDomain / MailFromDomainStatus fields.

Clearing the MAIL FROM domain also resets BehaviorOnMxFailure to
UseDefaultValue, matching AWS, so a cleared identity is indistinguishable
from one that was never configured.
This commit is contained in:
Kenshin Okinaka authored and GitHub committed 2026-06-13 02:16:14 -05:00
1 parent e8e44e70bc
commit a032ec5ac0
4 files changed
+20 -7

No files matched your search

@@ -32,14 +32,18 @@ class SesIdentityAttributesV2IntegrationTest {
.then()
.statusCode(200);
// Verify MailFromAttributes is omitted by default
// With no MAIL FROM domain configured, AWS keeps the MailFromAttributes
// block carrying only BehaviorOnMxFailure and omits the inner
// MailFromDomain / MailFromDomainStatus fields.
given()
.header("Authorization", AUTH_HEADER)
.when()
.get("/v2/email/identities/v2-attrs.floci.test")
.then()
.statusCode(200)
.body("MailFromAttributes", nullValue());
.body("MailFromAttributes.BehaviorOnMxFailure", equalTo("USE_DEFAULT_VALUE"))
.body("MailFromAttributes.MailFromDomain", nullValue())
.body("MailFromAttributes.MailFromDomainStatus", nullValue());
}
@Test
@@ -88,13 +92,18 @@ class SesIdentityAttributesV2IntegrationTest {
.then()
.statusCode(200);
// Clearing the MAIL FROM domain returns to the unconfigured shape:
// the block stays, BehaviorOnMxFailure resets to USE_DEFAULT_VALUE,
// and the inner domain / status fields drop out.
given()
.header("Authorization", AUTH_HEADER)
.when()
.get("/v2/email/identities/v2-attrs.floci.test")
.then()
.statusCode(200)
.body("MailFromAttributes", nullValue());
.body("MailFromAttributes.BehaviorOnMxFailure", equalTo("USE_DEFAULT_VALUE"))
.body("MailFromAttributes.MailFromDomain", nullValue())
.body("MailFromAttributes.MailFromDomainStatus", nullValue());
}
@Test
@@ -1189,7 +1189,9 @@ class SesV2IntegrationTest {
.body("DkimAttributes", notNullValue())
.body("DkimAttributes.SigningEnabled", notNullValue())
.body("DkimAttributes.Status", notNullValue())
.body("MailFromAttributes", nullValue())
.body("MailFromAttributes.BehaviorOnMxFailure", equalTo("USE_DEFAULT_VALUE"))
.body("MailFromAttributes.MailFromDomain", nullValue())
.body("MailFromAttributes.MailFromDomainStatus", nullValue())
.body("Policies", notNullValue())
.body("Tags", notNullValue());
}