mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -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
@@ -35,6 +35,20 @@ public class SqsQueryHandler {
|
||||
public Response handle(String action, MultivaluedMap<String, String> params, String region) {
|
||||
LOG.debugv("SQS action: {0}", action);
|
||||
|
||||
// Wrap like every other Query handler: without this, AwsExceptions escape to the
|
||||
// global JAX-RS mapper, which renders a JSON error body on this XML protocol.
|
||||
try {
|
||||
return dispatch(action, params, region);
|
||||
} catch (AwsException e) {
|
||||
return AwsQueryResponse.error(e.getErrorCode(), e.getMessage(), AwsNamespaces.SQS, e.getHttpStatus());
|
||||
} catch (Exception e) {
|
||||
LOG.errorv(e, "Unexpected error in SQS {0}", action);
|
||||
return AwsQueryResponse.error("InternalError",
|
||||
"Unexpected error: " + e.getMessage(), AwsNamespaces.SQS, 500);
|
||||
}
|
||||
}
|
||||
|
||||
private Response dispatch(String action, MultivaluedMap<String, String> params, String region) {
|
||||
return switch (action) {
|
||||
case "CreateQueue" -> handleCreateQueue(params, region);
|
||||
case "DeleteQueue" -> handleDeleteQueue(params, region);
|
||||
|
||||
Reference in new issue
Block a user