mirror of
https://github.com/floci-io/floci.git
synced 2026-12-05 02:58:00 -05:00
fix(ses): align v1 Query boolean parsing with probed xsd 1.1 behavior (#3075)
* fix(ses): align v1 Query boolean parsing with probed xsd 1.1 behavior Probed against real AWS SES: an absent Query-protocol boolean member is not an error, it deserializes to false and the request proceeds to semantic validation; a present-but-empty value is MalformedInput "missing value for boolean type"; any value other than case-sensitive true/false/1/0 is MalformedInput "boolean must follow xsd1.1 definition". Replace parseRequiredBoolean and parseOptionalBoolean with a single parseXsdBoolean implementing that contract, and update the affected integration tests. * test(ses): cover EventDestination.Enabled xsd boolean semantics Probed against real AWS SES: the nested EventDestination.Enabled member follows the same Query-protocol boolean contract as top-level members (absent deserializes to false, empty value and non-xsd values are the respective MalformedInput errors, and 1/0 are accepted).
This commit is contained in:
1 parent
a006b27694
commit
f677edad43
5 files changed
+270
-68
No files matched your search
+123
@@ -307,6 +307,129 @@ class SesConfigurationSetEventDestinationV1IntegrationTest {
|
||||
.body(containsString("SnsDestination requires a non-blank TopicArn"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(15)
|
||||
void createConfigurationSetEventDestination_nonXsdEnabled_returnsMalformedInput() {
|
||||
// EventDestination.Enabled follows the same strict xsd 1.1 lexical space as top-level
|
||||
// Query booleans (probed against real AWS 2026-09-05): even "TRUE" is MalformedInput.
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "CreateConfigurationSetEventDestination")
|
||||
.formParam("ConfigurationSetName", CS)
|
||||
.formParam("EventDestination.Name", "v1-ed-bool-bad")
|
||||
.formParam("EventDestination.Enabled", "TRUE")
|
||||
.formParam("EventDestination.MatchingEventTypes.member.1", "send")
|
||||
.formParam("EventDestination.SNSDestination.TopicARN", TOPIC_ARN_A)
|
||||
.when().post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(containsString("<Code>MalformedInput</Code>"))
|
||||
.body(containsString("boolean must follow xsd1.1 definition"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(16)
|
||||
void createConfigurationSetEventDestination_emptyEnabled_returnsMalformedInput() {
|
||||
// Probed against real AWS 2026-09-05: a present-but-empty nested boolean is the
|
||||
// dedicated "missing value" MalformedInput, same as top-level members.
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "CreateConfigurationSetEventDestination")
|
||||
.formParam("ConfigurationSetName", CS)
|
||||
.formParam("EventDestination.Name", "v1-ed-bool-empty")
|
||||
.formParam("EventDestination.Enabled", "")
|
||||
.formParam("EventDestination.MatchingEventTypes.member.1", "send")
|
||||
.formParam("EventDestination.SNSDestination.TopicARN", TOPIC_ARN_A)
|
||||
.when().post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(containsString("<Code>MalformedInput</Code>"))
|
||||
.body(containsString("missing value for boolean type"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(17)
|
||||
void createConfigurationSetEventDestination_absentEnabled_defaultsToFalse() {
|
||||
// Probed against real AWS 2026-09-05: an absent nested boolean deserializes to false
|
||||
// and the request proceeds, it is not a validation error.
|
||||
String ed = "v1-ed-bool-absent";
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "CreateConfigurationSetEventDestination")
|
||||
.formParam("ConfigurationSetName", CS)
|
||||
.formParam("EventDestination.Name", ed)
|
||||
.formParam("EventDestination.MatchingEventTypes.member.1", "send")
|
||||
.formParam("EventDestination.SNSDestination.TopicARN", TOPIC_ARN_A)
|
||||
.when().post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("CreateConfigurationSetEventDestinationResponse"));
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "DescribeConfigurationSet")
|
||||
.formParam("ConfigurationSetName", CS)
|
||||
.formParam("ConfigurationSetAttributeNames.member.1", "eventDestinations")
|
||||
.when().post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("<Name>" + ed + "</Name>"))
|
||||
.body(containsString("<Enabled>false</Enabled>"));
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "DeleteConfigurationSetEventDestination")
|
||||
.formParam("ConfigurationSetName", CS)
|
||||
.formParam("EventDestinationName", ed)
|
||||
.when().post("/")
|
||||
.then().statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(18)
|
||||
void createConfigurationSetEventDestination_numericEnabled_isAccepted() {
|
||||
// xsd 1.1 booleans: "1" is true for nested members too (probed 2026-09-05).
|
||||
String ed = "v1-ed-bool-numeric";
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "CreateConfigurationSetEventDestination")
|
||||
.formParam("ConfigurationSetName", CS)
|
||||
.formParam("EventDestination.Name", ed)
|
||||
.formParam("EventDestination.Enabled", "1")
|
||||
.formParam("EventDestination.MatchingEventTypes.member.1", "send")
|
||||
.formParam("EventDestination.SNSDestination.TopicARN", TOPIC_ARN_A)
|
||||
.when().post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "DescribeConfigurationSet")
|
||||
.formParam("ConfigurationSetName", CS)
|
||||
.formParam("ConfigurationSetAttributeNames.member.1", "eventDestinations")
|
||||
.when().post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("<Name>" + ed + "</Name>"))
|
||||
.body(containsString("<Enabled>true</Enabled>"));
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "DeleteConfigurationSetEventDestination")
|
||||
.formParam("ConfigurationSetName", CS)
|
||||
.formParam("EventDestinationName", ed)
|
||||
.when().post("/")
|
||||
.then().statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(99)
|
||||
void cleanup() {
|
||||
|
||||
+6
-6
@@ -246,10 +246,10 @@ class SesConfigurationSetSendingOptionsV2IntegrationTest {
|
||||
|
||||
@Test
|
||||
@Order(16)
|
||||
void v1_updateConfigurationSetSendingEnabled_nonBooleanEnabled_returnsInvalidParameterValue() {
|
||||
// parseRequiredBoolean enforces AWS-style "true"|"false". Anything else (e.g.
|
||||
// "yes") must surface as InvalidParameterValue instead of being silently
|
||||
// coerced to false (which would disable sending without the caller realizing).
|
||||
void v1_updateConfigurationSetSendingEnabled_nonBooleanEnabled_returnsMalformedInput() {
|
||||
// Query-protocol booleans are strict xsd 1.1 (probed against real AWS 2026-09-05):
|
||||
// anything but case-sensitive true/false/1/0 is MalformedInput rather than being
|
||||
// silently coerced to false (which would disable sending without the caller realizing).
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", SES_AUTH)
|
||||
@@ -260,8 +260,8 @@ class SesConfigurationSetSendingOptionsV2IntegrationTest {
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(containsString("<Code>InvalidParameterValue</Code>"))
|
||||
.body(containsString("Enabled"));
|
||||
.body(containsString("<Code>MalformedInput</Code>"))
|
||||
.body(containsString("boolean must follow xsd1.1 definition"));
|
||||
}
|
||||
|
||||
private static io.restassured.response.Response sendEmail(String configSet) {
|
||||
|
||||
+107
-10
@@ -160,7 +160,20 @@ class SesIdentityAttributesV1IntegrationTest {
|
||||
|
||||
@Test
|
||||
@Order(12)
|
||||
void setIdentityFeedbackForwardingEnabled_missingForwardingEnabled_returnsInvalidParameterValue() {
|
||||
void setIdentityFeedbackForwardingEnabled_missingForwardingEnabled_defaultsToFalse() {
|
||||
// Real AWS treats an absent Query-protocol boolean member as false instead of
|
||||
// rejecting the request (probed 2026-09-05): the call succeeds and disables forwarding.
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "SetIdentityFeedbackForwardingEnabled")
|
||||
.formParam("Identity", "v1-attrs.floci.test")
|
||||
.formParam("ForwardingEnabled", "true")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
@@ -169,40 +182,124 @@ class SesIdentityAttributesV1IntegrationTest {
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(containsString("InvalidParameterValue"));
|
||||
.statusCode(200)
|
||||
.body(containsString("SetIdentityFeedbackForwardingEnabledResponse"));
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "GetIdentityNotificationAttributes")
|
||||
.formParam("Identities.member.1", "v1-attrs.floci.test")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("<ForwardingEnabled>false</ForwardingEnabled>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(13)
|
||||
void setIdentityHeadersInNotificationsEnabled_missingEnabled_returnsInvalidParameterValue() {
|
||||
void setIdentityHeadersInNotificationsEnabled_missingEnabled_defaultsToFalse() {
|
||||
// Same absent-boolean default as Order(12); Delivery is used so the Bounce flag
|
||||
// set in Order(6) and asserted in Order(17) stays untouched.
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "SetIdentityHeadersInNotificationsEnabled")
|
||||
.formParam("Identity", "v1-attrs.floci.test")
|
||||
.formParam("NotificationType", "Bounce")
|
||||
.formParam("NotificationType", "Delivery")
|
||||
.formParam("Enabled", "true")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(containsString("InvalidParameterValue"));
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "SetIdentityHeadersInNotificationsEnabled")
|
||||
.formParam("Identity", "v1-attrs.floci.test")
|
||||
.formParam("NotificationType", "Delivery")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "GetIdentityNotificationAttributes")
|
||||
.formParam("Identities.member.1", "v1-attrs.floci.test")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("<HeadersInDeliveryNotificationsEnabled>false</HeadersInDeliveryNotificationsEnabled>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(14)
|
||||
void setIdentityFeedbackForwardingEnabled_invalidBoolean_returnsInvalidParameterValue() {
|
||||
void setIdentityFeedbackForwardingEnabled_invalidBoolean_returnsMalformedInput() {
|
||||
// Probed against real AWS 2026-09-05: anything but case-sensitive true/false/1/0
|
||||
// (even "TRUE") is MalformedInput, not InvalidParameterValue.
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "SetIdentityFeedbackForwardingEnabled")
|
||||
.formParam("Identity", "v1-attrs.floci.test")
|
||||
.formParam("ForwardingEnabled", "yes")
|
||||
.formParam("ForwardingEnabled", "TRUE")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(containsString("InvalidParameterValue"));
|
||||
.body(containsString("<Code>MalformedInput</Code>"))
|
||||
.body(containsString("boolean must follow xsd1.1 definition"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(24)
|
||||
void setIdentityFeedbackForwardingEnabled_emptyBoolean_returnsMalformedInput() {
|
||||
// Probed against real AWS 2026-09-05: a present-but-empty boolean value is its
|
||||
// own MalformedInput message, distinct from both the absent and malformed cases.
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "SetIdentityFeedbackForwardingEnabled")
|
||||
.formParam("Identity", "v1-attrs.floci.test")
|
||||
.formParam("ForwardingEnabled", "")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(containsString("<Code>MalformedInput</Code>"))
|
||||
.body(containsString("missing value for boolean type"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(25)
|
||||
void setIdentityFeedbackForwardingEnabled_numericBoolean_isAccepted() {
|
||||
// xsd 1.1 booleans: "1" is true (probed against real AWS 2026-09-05).
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "SetIdentityFeedbackForwardingEnabled")
|
||||
.formParam("Identity", "v1-attrs.floci.test")
|
||||
.formParam("ForwardingEnabled", "1")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "GetIdentityNotificationAttributes")
|
||||
.formParam("Identities.member.1", "v1-attrs.floci.test")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("<ForwardingEnabled>true</ForwardingEnabled>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -519,8 +519,8 @@ class SesIntegrationTest {
|
||||
|
||||
@Test
|
||||
@Order(26)
|
||||
void updateAccountSendingEnabled_treatsMissingOrBlankEnabledAsFalse() {
|
||||
// Missing Enabled parameter
|
||||
void updateAccountSendingEnabled_missingEnabledDefaultsToFalse_blankEnabledIsMalformed() {
|
||||
// Missing Enabled parameter defaults to false (probed against real AWS 2026-09-05)
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", authorization("email"))
|
||||
@@ -540,18 +540,8 @@ class SesIntegrationTest {
|
||||
.statusCode(200)
|
||||
.body(containsString("<Enabled>false</Enabled>"));
|
||||
|
||||
// restore so the next assertion observes the blank-string default cleanly
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", authorization("email"))
|
||||
.formParam("Action", "UpdateAccountSendingEnabled")
|
||||
.formParam("Enabled", "true")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
// Blank Enabled parameter (e.g. AWS CLI passing --enabled "") behaves the same
|
||||
// A present-but-blank Enabled (e.g. AWS CLI passing --enabled "") is rejected,
|
||||
// unlike the absent case (probed against real AWS 2026-09-05)
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", authorization("email"))
|
||||
@@ -560,17 +550,9 @@ class SesIntegrationTest {
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", authorization("email"))
|
||||
.formParam("Action", "GetAccountSendingEnabled")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("<Enabled>false</Enabled>"));
|
||||
.statusCode(400)
|
||||
.body(containsString("<Code>MalformedInput</Code>"))
|
||||
.body(containsString("missing value for boolean type"));
|
||||
|
||||
// restore default state for downstream tests
|
||||
given()
|
||||
@@ -645,7 +627,8 @@ class SesIntegrationTest {
|
||||
|
||||
@Test
|
||||
@Order(28)
|
||||
void updateAccountSendingEnabled_invalidValue_returns400() {
|
||||
void updateAccountSendingEnabled_invalidValue_returnsMalformedInput() {
|
||||
// Probed against real AWS 2026-09-05: non-xsd boolean values are MalformedInput
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", authorization("email"))
|
||||
@@ -655,6 +638,7 @@ class SesIntegrationTest {
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(containsString("InvalidParameterValue"));
|
||||
.body(containsString("<Code>MalformedInput</Code>"))
|
||||
.body(containsString("boolean must follow xsd1.1 definition"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user