mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(sqs): render Query-protocol errors as XML instead of leaking JSON (#1732)
* fix(sqs): render Query-protocol errors as XML instead of leaking JSON SqsQueryHandler was the only Query handler without top-level error wrapping, so AwsExceptions escaped to the global JAX-RS mapper and rendered a JSON body (application/json, __type) on the XML Query path. Wrap the dispatch like every other Query handler and emit the standard ErrorResponse envelope with the legacy Query error codes (QueueAlreadyExists, AWS.SimpleQueueService. NonExistentQueue). The existing conflicting-attributes test pinned the leaked JSON __type code and now asserts the XML shape; the JSON protocol path is unchanged. * test(cloudformation): assert legacy Query error code in assertQueueAbsent The StackSets helper probes queue absence over the SQS Query protocol but asserted QueueDoesNotExist, the JSON-protocol __type that only appeared there because Query errors leaked through the JSON mapper. With Query errors now rendered as XML, assert the legacy code AWS.SimpleQueueService.NonExistentQueue and the 400 status.
This commit is contained in:
1 parent
272e4136e5
commit
8893d2c51e
3 files changed
+42
-2
No files matched your search
+5
-1
@@ -53,7 +53,11 @@ class CloudFormationStackSetsIntegrationTest {
|
||||
.formParam("QueueName", queueName)
|
||||
.header("Authorization", auth(account, "sqs"))
|
||||
.when().post("/")
|
||||
.then().body(containsString("QueueDoesNotExist"));
|
||||
.then()
|
||||
.statusCode(400)
|
||||
// Query protocol renders the XML ErrorResponse with the legacy Query code;
|
||||
// QueueDoesNotExist is its JSON-protocol __type equivalent (see AwsException).
|
||||
.body(containsString("AWS.SimpleQueueService.NonExistentQueue"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -483,7 +483,10 @@ class SqsIntegrationTest {
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body(containsString("QueueNameExists"));
|
||||
// Query protocol renders the XML ErrorResponse with the legacy Query code;
|
||||
// QueueNameExists is its JSON-protocol __type equivalent (see AwsException).
|
||||
.contentType(containsString("xml"))
|
||||
.body("ErrorResponse.Error.Code", equalTo("QueueAlreadyExists"));
|
||||
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
@@ -612,6 +615,25 @@ class SqsIntegrationTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void queryProtocolErrorsAreXmlNotJson() {
|
||||
// Regression: AwsExceptions escaping SqsQueryHandler used to reach the global
|
||||
// JAX-RS mapper and render a JSON body on this XML protocol.
|
||||
given()
|
||||
.contentType("application/x-www-form-urlencoded")
|
||||
.formParam("Action", "GetQueueUrl")
|
||||
.formParam("QueueName", "does-not-exist-queue")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.contentType(containsString("xml"))
|
||||
.body("ErrorResponse.Error.Type", equalTo("Sender"))
|
||||
.body("ErrorResponse.Error.Code", equalTo("AWS.SimpleQueueService.NonExistentQueue"))
|
||||
.body("ErrorResponse.Error.Message",
|
||||
equalTo("The specified queue does not exist for this wsdl version."));
|
||||
}
|
||||
|
||||
@Test
|
||||
void sendMessageBatch_queryProtocol_persistsAwsTraceHeaderPerEntry() {
|
||||
String traceQueueName = "query-batch-trace-queue";
|
||||
|
||||
Reference in new issue
Block a user