fix(dynamodb): validate sort key in buildItemKey to prevent item collisions (#506)

This commit is contained in:
Christine Nguyen authored and GitHub committed 2026-04-18 11:14:10 -05:00
1 parent 63ed81c59d
commit 247c62cd19
3 files changed
+158 -2

No files matched your search

@@ -1622,9 +1622,11 @@ public class DynamoDbService {
String skName = table.getSortKeyName();
if (skName != null) {
JsonNode skAttr = item.get(skName);
if (skAttr != null) {
return pk + "#" + extractScalarValue(skAttr);
if (skAttr == null) {
throw new AwsException("ValidationException",
"One of the required keys was not given a value", 400);
}
return pk + "#" + extractScalarValue(skAttr);
}
return pk;
}