mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
fix(ses): return DeliveryOptions from v1 DescribeConfigurationSet (#2841)
PutConfigurationSetDeliveryOptions already persisted the TLS policy — v2 GetConfigurationSet returned it correctly — but the v1 projection never read it back, omitting the DeliveryOptions member even when deliveryOptions was named in ConfigurationSetAttributeNames. The Terraform provider reads aws_ses_configuration_set through the v1 DescribeConfigurationSet, so the missing member made every plan re-add a delivery_options block that apply never converged. The two APIs spell the enum differently and the write path already normalises v1 Require/Optional to the stored REQUIRE/OPTIONAL; the read path converts back, so each API answers in its own casing.
This commit is contained in:
1 parent
10ce6be8cd
commit
7473c57720
3 files changed
+124
-1
No files matched your search
@@ -311,6 +311,6 @@ ARN handling is uniform across the six types (probe-confirmed against real AWS).
|
||||
|
||||
The same AWS-compatible validation applies wherever tags are set (including `CreateContactList` and `TagResource`): at most 50 tags, unique keys, keys 1–128 / values 0–256 code points, characters limited to letters, numbers, Unicode whitespace and `_ . : / = + - @`, and the reserved `aws:` key prefix. `TagResource` applies the 50-tag limit to the merged (existing + incoming) set. Violations return `BadRequestException` with AWS's messages.
|
||||
|
||||
Identity, identity-policy, template, custom-verification-template, configuration-set, and sent-message state is shared between the v1 Query API and the v2 REST JSON API, so a template created with `CreateTemplate` resolves through `SendEmail` on v2 (and vice versa), a policy written with `PutIdentityPolicy` (v1) is returned by `GetEmailIdentityPolicies` (v2), a custom verification email template created with `CreateCustomVerificationEmailTemplate` (v1) is returned by `GetCustomVerificationEmailTemplate` (v2), a configuration set created with `CreateConfigurationSet` is visible to both `DescribeConfigurationSet` (v1) and `GetConfigurationSet` (v2), and every send appears in the same `GET /_aws/ses` inspection mailbox.
|
||||
Identity, identity-policy, template, custom-verification-template, configuration-set, and sent-message state is shared between the v1 Query API and the v2 REST JSON API, so a template created with `CreateTemplate` resolves through `SendEmail` on v2 (and vice versa), a policy written with `PutIdentityPolicy` (v1) is returned by `GetEmailIdentityPolicies` (v2), a custom verification email template created with `CreateCustomVerificationEmailTemplate` (v1) is returned by `GetCustomVerificationEmailTemplate` (v2), a configuration set created with `CreateConfigurationSet` is visible to both `DescribeConfigurationSet` (v1) and `GetConfigurationSet` (v2), delivery options written with either `PutConfigurationSetDeliveryOptions` read back through both (v1 spells the policy `Require`/`Optional`, v2 `REQUIRE`/`OPTIONAL`, matching each API), and every send appears in the same `GET /_aws/ses` inspection mailbox.
|
||||
|
||||
DKIM follows AWS's domain-centric model. A **domain** identity carries DKIM tokens (generated at verification, stable across `VerifyDomainDkim` calls); its `DkimVerificationStatus` tracks **DNS record detection** — it transitions to `Success` when the expected `<token>._domainkey.<domain>` CNAMEs are present in the Route53 emulation, not when DKIM is enabled. An **email** identity has no DKIM of its own: its `DkimAttributes` (`SigningEnabled`, `Status`, `Tokens`) are inherited from its parent domain identity when one is registered. The parent is the exact domain after the `@` (verified against AWS): a verified `example.com` covers `user@example.com` but not `user@mail.example.com` unless `mail.example.com` is itself a registered identity. `SetIdentityDkimEnabled` / `PutEmailIdentityDkimAttributes` only toggle the signing flag (they no longer force the verification status); `PutEmailIdentityDkimSigningAttributes` sets the signing origin (`AWS_SES` Easy DKIM — regenerating tokens when the key length changes — or `EXTERNAL` BYODKIM).
|
||||
@@ -770,6 +770,12 @@ public class SesQueryHandler {
|
||||
.elem("CustomRedirectDomain", cs.getTrackingOptions().getCustomRedirectDomain())
|
||||
.end("TrackingOptions");
|
||||
}
|
||||
if (attrs.contains("deliveryOptions") && cs.getDeliveryOptions() != null
|
||||
&& cs.getDeliveryOptions().getTlsPolicy() != null) {
|
||||
xml.start("DeliveryOptions")
|
||||
.elem("TlsPolicy", toV1TlsPolicy(cs.getDeliveryOptions().getTlsPolicy()))
|
||||
.end("DeliveryOptions");
|
||||
}
|
||||
return Response.ok(AwsQueryResponse.envelope("DescribeConfigurationSet",
|
||||
AwsNamespaces.SES, xml.build())).build();
|
||||
}
|
||||
@@ -951,6 +957,19 @@ public class SesQueryHandler {
|
||||
"PutConfigurationSetDeliveryOptions", AwsNamespaces.SES)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* V1 spells the TLS policy {@code Require}/{@code Optional}; Floci stores the V2 canonical
|
||||
* {@code REQUIRE}/{@code OPTIONAL} that {@link #handlePutConfigurationSetDeliveryOptions}
|
||||
* normalises to. Anything unrecognised is passed through unchanged rather than mangled.
|
||||
*/
|
||||
private static String toV1TlsPolicy(String stored) {
|
||||
return switch (stored) {
|
||||
case "REQUIRE" -> "Require";
|
||||
case "OPTIONAL" -> "Optional";
|
||||
default -> stored;
|
||||
};
|
||||
}
|
||||
|
||||
private Response handleCreateReceiptRuleSet(MultivaluedMap<String, String> params, String region) {
|
||||
sesService.createReceiptRuleSet(getParam(params, "RuleSetName"), region);
|
||||
return Response.ok(AwsQueryResponse.envelopeEmptyResult(
|
||||
|
||||
+104
@@ -8,6 +8,7 @@ import org.junit.jupiter.api.TestMethodOrder;
|
||||
|
||||
import static io.restassured.RestAssured.given;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
|
||||
/**
|
||||
* Integration tests for SES V1 Query-protocol ConfigurationSet CRUD.
|
||||
@@ -252,4 +253,107 @@ class SesConfigurationSetV1IntegrationTest {
|
||||
.body(containsString("deliveryOptions.tlsPolicy"))
|
||||
.body(containsString("[Optional, Require]"));
|
||||
}
|
||||
|
||||
/**
|
||||
* The write path already stored the TLS policy — v2 {@code GetConfigurationSet} returned it —
|
||||
* but the v1 projection never read it back, so the Terraform provider re-added the block on
|
||||
* every plan. Order 11 above sets a policy and never describes it, which is how the gap
|
||||
* survived; this covers the read.
|
||||
*/
|
||||
@Test
|
||||
@Order(14)
|
||||
void describeConfigurationSetReturnsDeliveryOptions() {
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "CreateConfigurationSet")
|
||||
.formParam("ConfigurationSet.Name", "v1-cs-delivery-readback")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
// Never set: AWS omits the member even when it is explicitly requested.
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "DescribeConfigurationSet")
|
||||
.formParam("ConfigurationSetName", "v1-cs-delivery-readback")
|
||||
.formParam("ConfigurationSetAttributeNames.member.1", "deliveryOptions")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(not(containsString("<DeliveryOptions>")));
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "PutConfigurationSetDeliveryOptions")
|
||||
.formParam("ConfigurationSetName", "v1-cs-delivery-readback")
|
||||
.formParam("DeliveryOptions.TlsPolicy", "Require")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
// V1 spells it Require, not the V2 REQUIRE that is stored internally.
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "DescribeConfigurationSet")
|
||||
.formParam("ConfigurationSetName", "v1-cs-delivery-readback")
|
||||
.formParam("ConfigurationSetAttributeNames.member.1", "deliveryOptions")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("<DeliveryOptions>"))
|
||||
.body(containsString("<TlsPolicy>Require</TlsPolicy>"));
|
||||
|
||||
// Gated on the attribute name: without it the member stays out, as AWS does.
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "DescribeConfigurationSet")
|
||||
.formParam("ConfigurationSetName", "v1-cs-delivery-readback")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(not(containsString("<DeliveryOptions>")));
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "PutConfigurationSetDeliveryOptions")
|
||||
.formParam("ConfigurationSetName", "v1-cs-delivery-readback")
|
||||
.formParam("DeliveryOptions.TlsPolicy", "Optional")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "DescribeConfigurationSet")
|
||||
.formParam("ConfigurationSetName", "v1-cs-delivery-readback")
|
||||
.formParam("ConfigurationSetAttributeNames.member.1", "deliveryOptions")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200)
|
||||
.body(containsString("<TlsPolicy>Optional</TlsPolicy>"));
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.header("Authorization", AUTH)
|
||||
.formParam("Action", "DeleteConfigurationSet")
|
||||
.formParam("ConfigurationSetName", "v1-cs-delivery-readback")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user