fix(sqs): skip JSON null tag/attribute values instead of storing literal "null" (#905)

* fix(sqs): skip JSON null values in TagQueue tags and attribute maps

JsonNode.asText() returns the literal string "null" for explicit JSON
null values. This caused TagQueue with {"Tags":{"NullTag":null}} to
store the four-character string "null" as the tag value, surfacing on
the wire as <Value>null</Value> when read back via ListQueueTags.

Same path is used for CreateQueue / SetQueueAttributes attribute maps,
where a null-valued attribute would have stored the same literal.

Skip null/missing JsonNode values in jsonNodeToMap so the absent key
round-trips as absent rather than as the string "null".

* fix(sqs): reject JSON null tag/attribute values with InvalidParameterValue

Match real AWS behavior: return HTTP 400 InvalidParameterValue with
'the parameter "value" may not be null' when a JSON 1.0 TagQueue,
CreateQueue, or SetQueueAttributes request contains a null map value,
rather than silently skipping the entry.

Adds regression coverage for TagQueue, CreateQueue (tags + attributes),
and SetQueueAttributes.
This commit is contained in:
Stuart Lang authored and GitHub committed 2026-05-18 20:55:15 -05:00
1 parent 337b35c938
commit aec85f993a
2 files changed
+93 -1

No files matched your search

@@ -516,7 +516,14 @@ public class SqsJsonHandler {
private Map<String, String> jsonNodeToMap(JsonNode node) {
Map<String, String> map = new HashMap<>();
if (node != null && node.isObject()) {
node.fields().forEachRemaining(entry -> map.put(entry.getKey(), entry.getValue().asText()));
node.fields().forEachRemaining(entry -> {
JsonNode value = entry.getValue();
if (value == null || value.isNull() || value.isMissingNode()) {
throw new AwsException("InvalidParameterValue",
"the parameter 'value' may not be null", 400);
}
map.put(entry.getKey(), value.asText());
});
}
return map;
}