mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(dynamodb): reject redundant parens, contains() dup operand, begins_with non-string (#1442)
* fix(dynamodb): reject redundant parens, contains() dup operand, begins_with non-string Add ExpressionEvaluator.validateExpression for structural/semantic checks DynamoDB rejects at parse time, wired into Put/Delete/Update/Query/Scan handlers with the correct Invalid <ExprType> prefix. Closes 11 conformance failures across tier1 paren tests and tier3 exact error-message tests. * test(dynamodb): expect ValidationException for redundant double parens scanFilterDoubleNestedParens asserted that ((category = :a)) returns 200, but real AWS DynamoDB rejects redundant (doubled) parentheses with a ValidationException at parse time. The new validateExpression() check now correctly returns 400, so update the test to assert the rejection. Verified against moto/AWS DDB parity: ((a < b)) fails while ((a = :b) OR (c = :d)) is allowed.
This commit is contained in:
1 parent
aaa1faa7fe
commit
1f99d92554
3 files changed
+156
-8
No files matched your search
+16
-8
@@ -223,14 +223,22 @@ class DynamoDbFilterExpressionIntegrationTest {
|
||||
|
||||
@Test
|
||||
void scanFilterDoubleNestedParens() {
|
||||
// ((category = :a)) should work like category = :a → u1, u3
|
||||
scanWithFilter(
|
||||
"((category = :a))",
|
||||
"""
|
||||
{":a": {"S": "A"}}
|
||||
""",
|
||||
null,
|
||||
2);
|
||||
// AWS DynamoDB rejects redundant (doubled) parentheses such as ((category = :a))
|
||||
// with a ValidationException at parse time — verified against moto/AWS DDB parity,
|
||||
// where ((a < b)) fails but ((a = :b) OR (c = :d)) is allowed.
|
||||
given()
|
||||
.header("X-Amz-Target", "DynamoDB_20120810.Scan")
|
||||
.contentType(DYNAMODB_CONTENT_TYPE)
|
||||
.body("""
|
||||
{"TableName": "%s", "FilterExpression": "((category = :a))", \
|
||||
"ExpressionAttributeValues": {":a": {"S": "A"}}}
|
||||
""".formatted(TABLE_NAME))
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", containsString("ValidationException"))
|
||||
.body(containsString("redundant parentheses"));
|
||||
}
|
||||
|
||||
// ---- Parenthesized BETWEEN in KeyConditionExpression ----
|
||||
|
||||
Reference in new issue
Block a user