Repository navigation
fix(scan): check the numbers in ExpressionAttributeValues as the service does - #562
LeeroyHannigan wants to merge 52 commits into
Conversation
…rules
A Query with a KeyConditionExpression did not check a key condition value's
type against the key attribute's AttributeDefinitions type, and did not check
that an N value in ExpressionAttributeValues is a number. The storage layer
compared the value's inner text with the stored key and ignored the type tag,
so {"N": "bob"} on an S partition key read the bob partition while
authorization bound no dynamodb:LeadingKeys value to it, and a sort key value
of another type answered InternalServerError on SQLite.
Add the two checks the service applies before it reads a row, on the
expression path (crates/engine/src/query_key_values.rs):
- an N value in ExpressionAttributeValues that is not a number answers
"The parameter cannot be converted to a numeric value: <value>" (the
overflow and 38-digit texts for those cases; an empty value answers the
message with the colon). The check covers the whole map, including NS
members and values nested in L and M, whether the key condition, the
filter or nothing reads them, with the walk PutItem and UpdateItem already
use. It runs at request time after the Limit and expression parameter mix
checks and before the table lookup, which moves those two checks ahead of
the table lookup as well. The server runs the same request-time checks
ahead of the IAM decision, so a principal under any LeadingKeys fence form
gets ValidationException and no items;
- a key condition value whose type is not the key attribute's type answers
"One or more parameter values were invalid: Condition parameter type does
not match schema type", for the partition key, the sort key under every
comparison operator, both BETWEEN bounds, the begins_with prefix and
multi-attribute index keys, after the key schema, filter, projection,
unused value and Select checks and before the ExclusiveStartKey check. When
a compared placeholder is undefined the check returns without a verdict and
the undefined placeholder is reported.
Measured on the service on 2026-10-24 (113 requests, each sent twice). The
legacy KeyConditions path is unchanged; its checks land with #507. Scan is
unchanged. Unit tests at the checks and a dual-target wire test file,
tests/test_query_key_value_types.py, which fails on main.
… service's order The server ran its pre-IAM checks only when the body deserialized as QueryInput, and the engine checked the ReturnConsumedCapacity and Select enums before them, so a Query carrying an invalid Select and an N value that is not a number answered the Select message, or AccessDeniedException for a principal whose LeadingKeys fence needs a value. The checks now read the raw body in the service's order, measured 2026-10-24: Limit, the expression and non-expression parameter mix, ReturnConsumedCapacity, every number in ExpressionAttributeValues, then Select. The engine and the server run the same function.
…y sentence matches the other backends
…ort a shape fault ahead of the request-time checks The request-time number check refused an N value written with a Unicode decimal digit (fullwidth, Arabic-Indic, Devanagari) that the service accepts as the digit it stands for, so a Query that returns rows on the service answered ValidationException here. The check now folds every general category Nd digit to ASCII before the number rules run and echoes the value as the request wrote it when the rules refuse it; the Nd zero code points of Unicode 15.0 live in a module of their own. The fold applies to the check only: the handler and the server's key binding read the value as written. The write paths are unchanged. The checks run on the raw body before deserialization, so a field of the wrong JSON type elsewhere in the body (a string ExpressionAttributeValues beside a Limit of 0, a string ExpressionAttributeNames beside a malformed N, a numeric Select) answered the check's ValidationException where the service and the previous release answered SerializationException. When a check fails, the body is now deserialized as the typed input and a SerializationException from that is returned instead; a ValidationException the deserializer raises does not preempt the check, and a body that passes every check is not deserialized twice. The server's call before dispatch goes through the same function. Measured against the service on 2026-10-25 (11:31 UTC) on tables with S/N and S/S keys, each request twice. Unit tests cover the digit table, the folded check and the shape-fault order; the wire file gains the measured rows for both.
…ks, and assert only acceptance for Unicode digits
The shape-fault pass returned the deserializer's SerializationException for an
AttributeValue with an unknown type descriptor, so Limit 0 beside {"X": "1"}
changed class. The service answers the Limit ValidationException for that
body (measured 2026-10-25), and the check's answer is returned again.
The Unicode digit tests asserted that a key condition or filter written with
a Unicode digit reads the item stored with the ASCII digit. This change makes
the request-time check accept such a value; it does not change how the
handler reads it, so the tests assert only that the value is accepted. A new
test checks that a partition key value written with Unicode digits returns no
item of a partition a ForAllValues LeadingKeys fence keeps the caller from.
…time
Scan did not check that the N values in ExpressionAttributeValues are
numbers, so a filter on {"N": "bob"}, a nested one in an L, M or NS, an
overflow, an underflow, a 39 digit value or an empty N answered 200 with
Count 0. The service refuses each with the same ValidationException text
Query uses, whether or not an expression reads the value.
Move the early Scan checks to a request-time function on the raw body,
in the order measured on 2026-10-25: the Limit, Segment and TotalSegments
ranges (one aggregated message, "Value at 'Limit'" with no value echoed),
the expression and non-expression parameter mix, the ReturnConsumedCapacity
enum, every number in ExpressionAttributeValues, then the Select enum.
Both enums invalid now answers the ReturnConsumedCapacity error alone, as
the service does; the earlier aggregation of the two no longer matched it.
The Segment pairing checks stay in the handler after the table lookup.
The two Scan tests that asserted the old segment range text now assert the
measured text.
…tion Every N value shape the service refuses on Scan (a word, a nested L, M or NS member, overflow, underflow, 39 digits, empty, a leading space), read by the filter or by nothing, and the order against every other early check: the Limit, Segment and TotalSegments ranges, the parameter mix and the ReturnConsumedCapacity enum ahead of it; the Select enum, the Segment pairing, the table lookup, IndexName, ConsistentRead, Select with ProjectionExpression, ExclusiveStartKey, undefined placeholder and filter syntax checks behind it. Expected texts measured on 2026-10-25.
… accept Unicode decimal digits The range checks on Limit, Segment and TotalSegments reported every fault in one aggregated message with a capitalised field name and no value for all three fields. The service uses that form for a Limit inside the int32 range and saturates the value into the older form below it (Limit -2147483649 answers Value '-2147483648' at 'limit'); the Segment and TotalSegments texts and the aggregation are a separate question. The checks now report the first fault in the order Limit, Segment, TotalSegments; Limit follows the measured int32 rule and the two segment fields keep the texts of the previous release. The two assertions in tests/test_query_scan.py go back to the previous text. A field of the wrong JSON type in another field (a string ExpressionAttributeValues beside Limit 0, a string TotalSegments beside Segment -1, a string ExpressionAttributeNames beside a malformed N, an object AttributesToGet beside ProjectionExpression) answered the check's ValidationException where the service and the previous release answer SerializationException. When a check fails the body is deserialized as the typed input and a SerializationException from that is returned instead, with the helper the Query path uses. A Unicode decimal digit in an N value passes the request-time check shared with Query, as it does on the service. The filter compares the value as the request wrote it, as on the previous release. The unit test for the parameter mix no longer asserts that an empty ScanFilter beside a FilterExpression passes, which the service refuses as a parameter mix; the engine's handling of an empty ScanFilter and an empty AttributesToGet is unchanged and covered by a separate issue. Measured against the service on 2026-10-25 (10:38, 10:55 and 11:31 UTC), each request twice.
Conflict in crates/server/src/request_helpers.rs (authorize_request): main moves the ARN shape checks and the GetRecords iterator decode ahead of the dev-mode return. The resolution keeps the main version and puts the Query request checks of this branch after the tag ARN shape check and before validate_operation_arns. Thus the Query checks also run in dev mode.
Main changes resolve_multipart to take the HASH and the RANGE attribute names (#429). The multi-attribute HASH test now gives r as the RANGE attribute, as its attribute definitions do.
…l as the service does On a single-attribute key schema, the later check of this branch now reports a wrong type in a key condition expression, as the service does. The early check from main still runs there for legacy KeyConditions, which the later check skips. The begins_with refusal now reads the type of the value instead of the type of the sort key.
…rder comments Two new rows send begins_with with an N value on an attribute that is not in the key schema. One row uses a table with an S sort key and the other uses a table with an N sort key. The service refuses both requests with the begins_with operand type message. The comments in handle_query now say that the classifier checks the values of legacy KeyConditions. They also say which attribute definitions it uses for each kind of key schema. The doc of resolve_key_schema_with now says where the service reports a wrong type on a single-attribute key schema (measured 2026-11-06).
When a request-time check fails, shape_fault_first deserializes each
member on its own. It reports a member of the wrong JSON type ahead of
the check, as the service does. It counted two nulls as such a member.
ScanIndexForward: null beside Select: "NOPE" answered
SerializationException here, where the service and main answer the
Select text. ExpressionAttributeNames: {"#a": null} beside an invalid
Select or ReturnConsumedCapacity did the same.
The service reads a null member as an absent one and a null name as an
empty name, which it reports after these checks. shape_fault_first now
skips a null member, with the rule present() already applies to the
parameter mix, and reads ExpressionAttributeNames without its null
names. The handler's deserializer still refuses both nulls.
I measured the service answers on 2026-11-24, each body twice. On
d7e6ff3, the 3 new unit rows fail, and the 3 new rows in
tests/test_query_value_shapes.py fail.
For an ExpressionAttributeValues value with two type descriptors,
first_fault reads each payload and names the first fault ahead of the
more than one datatypes text. It read the numbers only. The service
also refuses an empty set and a set with a duplicate member there.
{"SS": ["a", "a"], "N": "1"} answered the more than one datatypes text
here, where the service answers "Input collection [a, a] contains
duplicates." for :z, and {"NS": ["1", "1"], "S": "x"} answers "Input
collection contains duplicates".
first_fault now takes these set faults too, on this path only. It reads
SS ahead of the numbers, so {"SS": ["a", "a"], "N": "bob"} answers the
duplicate text. It reads NS after its own numbers, so {"NS": ["1", "1"],
"N": "bob"} answers the numeric text. The SS and BS texts come from the
AttributeValue deserializer. The NS text and its check move from core's
partiql module to validation::number, so a build without the partiql
feature has them. The deserializer still reports a set with a duplicate
member and no second descriptor, as before.
I measured the service answers on 2026-11-24, each body twice. On
0e0f078, 12 of the 15 new unit rows fail, and 12 of the 15 new rows
in tests/test_query_value_shapes.py fail. The 3 rows that answer the
numeric text pass there and pin what does not change.
Brings in 0e0f078, 35910e9 and the merge of main at 44cd436. One conflict, in crates/engine/src/query_key_values.rs, in the shape fault walk. This branch widens the number arm to Limit, Segment and TotalSegments where the other branch adds the ExpressionAttributeNames arm. The merge keeps both arms.
Main is at 14ade59. This branch last had main at 018715e, through fix/query-key-value-types. Since then, these eleven commits merged into main: #1280, #1009, #596, #1173, #398, #428, #544, #567, #584, #588 and #864. #544 is the squash of fix/query-key-value-types, which was the base branch of this PR. This branch already holds the last head of that branch, 31c5f3d. Main has the same version of each conflicted file as 31c5f3d. So each conflict hunk has the lines of #544 on one side. The other side has the change of this branch to the same lines. The merge keeps the version of this branch in each file: - crates/engine/src/query_key_values.rs: this branch makes two constants and four functions pub(crate) for the Scan checks, and re-exports three functions of unreadable.rs. It reads a number in Segment and TotalSegments as it reads one in Limit, with the dates in the doc comment of shape_fault_first. It passes validate_no_parameter_mix to unreadable_value_checks. - crates/engine/src/query_key_values/unreadable.rs: this branch makes three functions pub(crate). unreadable_value_checks takes the parameter mix check as a parameter, so this branch deletes the import of validate_no_parameter_mix. - crates/server/src/request_helpers.rs: this branch runs the Scan request checks before the IAM decision, as main does for Query. - tests/test_query_leading_keys_values.py: this branch moves the setup of TestLeadingKeysWithAnInvalidKeyValue to the base class ManagementPrincipals, which tests/test_scan_checks_before_authorization.py imports. Git merged crates/engine/src/lib.rs with no conflict. Main compiles three modules only off wasm32 (backup, import_export_io and private_fs), and adds the modules backup_requests and pre_dispatch. This branch adds the module scan_request and changes the doc comment of validate_enum_fields.
LJMart11
left a comment
There was a problem hiding this comment.
Reviewed at 009c4c1. Engine (986) and server (526) lib tests passed at this head, and removing each request-time Scan check in scan_request.rs fails at least one unit test. The open item is upgrade documentation for the client-visible Scan changes.
Docs — outside the diff
docs/manuals/07-upgrade-manual.md:385— Please add a Behavior Changes by Release entry in docs/manuals/07-upgrade-manual.md for the two breaking changes the PR body lists. A Scan with a non-numericNinExpressionAttributeValuesnow gets 400 where it got 200 withCount: 0, and a malformed Scan from a principal denied Scan now getsValidationExceptionwhere it gotAccessDeniedException. Main's SearchVectors entry at line 423, from #1449 in this merge, records the same pre-IAM change for that operation. A matching Scan entry under line 385 would close this.
Main is at c057660, 20 commits after 5026c89, the main commit of the last merge (009c4c1). No file conflicted. Two files that this branch changes also change on main. Git merged both with no overlap: - crates/engine/src/lib.rs: #481 adds the query_key_size_tests module next to the scan_request module of this branch. - crates/server/src/request_helpers.rs: #1290 changes how extract_operation builds the MissingAuthenticationToken error. This branch changes authorize_request.
The breaking changes of this branch had no entry in the upgrade manual. The new v1.2.0 entry comes after the three v1.2.0 entries of main. It lists: - the number check on the values of ExpressionAttributeValues, with the 1.1.0 answers that it replaces - the order of the checks before the table lookup, and the Limit text - the checks before the IAM decision, which answer ValidationException where 1.1.0 answered AccessDeniedException
|
LJMart11
left a comment
There was a problem hiding this comment.
Checked at 4c08c09 against the list from 009c4c1.
The follow-up adds the v1.2.0 Scan entry to the upgrade manual and merges main. The entry sits under Behavior Changes by Release and covers the number check, the new check order, the Limit text and the checks before the IAM decision. The Scan wire tests (test_scan_number_values.py, test_scan_checks_before_authorization.py) passed 90 of 90 against a SQLite build of the head, and the engine lib tests passed 989 under Rust 1.94.0.
Previous items: 1 fixed.
Main is at 5826e1b, three commits past c057660: #1531, #1466 and #1087. In docs/manuals/07-upgrade-manual.md, #1531 adds a v1.2.0 entry at the top of "Behavior Changes by Release", and git merged it with no conflict. #1087 adds its v1.2.0 entry after the other v1.2.0 entries of main, where this branch has its entry. That is the one conflict. The merge keeps both entries without change: the entry of #1087 first, then the entry of this branch, before the v1.1.0 entries. No other file has changes on both sides. #1087 changes how SQLite puts items in parallel Scan segments. This branch changes the Scan request checks in crates/engine, and #1087 changes no file in that crate.
|
Checked at Fixed:
Disputed: none. Needs-human: none. |
Changes since the last review
LJMart11 reviewed 4c08c09 on 3 Dec. One commit comes after that review:
docs/manuals/07-upgrade-manual.md, fix(storage-cassandra): retry a lost UpdateItem version check over the PutItem and DeleteItem window #1531 adds a v1.2.0 entry at the top of "Behavior Changes by Release", and git merged it with no conflict. fix(storage-sqlite): keep each partition key in one parallel Scan segment #1087 adds its v1.2.0 entry after the other v1.2.0 entries of main, where this branch has its entry. That is the one conflict. The merge keeps both entries without change: the entry of fix(storage-sqlite): keep each partition key in one parallel Scan segment #1087 first, then the entry of this branch, above the v1.1.0 entries. No other file has changes on both sides, and the lines that this branch changes against main are the same before and after the merge. fix(storage-sqlite): keep each partition key in one parallel Scan segment #1087 changes how SQLite puts items in parallel Scan segments, and it changes no file incrates/engine. The Gates section gives the gates at c06130a.LJMart11 reviewed 009c4c1 before that. Two commits came between the two reviews:
docs/manuals/07-upgrade-manual.md. Its heading is "v1.2.0:Scanchecks its values against the number rules, before the table lookup and the IAM decision". It comes after the three v1.2.0 entries of main. It gives the number check with the 1.1.0 answers that it replaces. It also gives the order of the checks with the newLimittext, and the checks before the IAM decision. The entry names the dates of the DynamoDB measurements.crates/engine/src/lib.rsandcrates/server/src/request_helpers.rswith no overlap: fix(query): refuse key condition values over the key size limits #481 adds a test module in the first, and fix(core): answer a request with no Authorization header as DynamoDB does #1290 changesextract_operationin the second. Testing done gives the gates at 4c08c09.These changes came before the review of 009c4c1:
crates/engine/src/query_key_values.rs,crates/engine/src/query_key_values/unreadable.rs,crates/server/src/request_helpers.rsandtests/test_query_leading_keys_values.py. Git mergedcrates/engine/src/lib.rswith no conflict. The gates on the merge:cargo +1.97.0 fmt --all -- --checkis clean..github/workflows/clippy.ymlwith-D warningsandcargo +1.91.1 check --all-targetsare clean onextenddb-core,extenddb-engineandextenddb-server.backup_storetests that fail on this host, as the Gates section says.python3 -m pytest --collect-only -qcollects 7161 tests intests/and 672 intests/pythonwith no error..github/workflows/wasm.ymlis clean on the merge with the two commits of fix(core): read the latency segment clock through web_time #1482, which fixes the WebAssembly build of main.fix/query-key-value-typesat 31c5f3d, which merges main at 018715e. 330d685 merged fix(query): check Query values against the key schema and the number rules #544's merge of main at b3c54f6. No file conflicted in either merge. Main's fix(scan): drop the FilterExpression suffix from the values message #765 passes no expression parameters to the Scan values check incrates/engine/src/scan.rs. So a Scan withExpressionAttributeValuesand no expression that reads them gets the message with no suffix, as on the service. On the merged tree,cargo fmt --checkis clean, andcargo clippy --all-targets -- -D warningsis clean onextenddb-coreandextenddb-engine. The core lib tests give 1146 passed and 1 ignored. The engine lib tests give 935 passed and 1 failed. The failed test,backup::tests::a_status_write_error_makes_no_store_call_and_leaves_the_manifest, is outside this branch and passed in 5 of 5 runs after that.fix/query-key-value-typesat 4b5125a, the head of fix(query): check Query values against the key schema and the number rules #544 after its third fix round (0e0f078 and 35910e9) and its merge of main at 44cd436. One conflict, incrates/engine/src/query_key_values.rs, in the shape fault walk. This branch widens the number arm toLimit,SegmentandTotalSegmentswhere fix(query): check Query values against the key schema and the number rules #544 adds theExpressionAttributeNamesarm. The merge keeps both arms. With it, Scan's shape check reads a null member as absent and drops a null name before the typed read. The path for a value the service cannot read as one type now checks a set beside a second type descriptor too, as in fix(query): check Query values against the key schema and the number rules #544. An empty set or a duplicate member there is a fault of that value. I ran the gates again at ad5f485. The list below names that head.fix/query-key-value-typesat d7e6ff3, the head of fix(query): check Query values against the key schema and the number rules #544 after its two fix rounds. The merge commit does not build on its own: therevalidate_expression_attribute_value_numbersis private and takes the rawExpressionAttributeValuesmap. 039729c makes it build. The merge also brings main's fix for an exponent outside int32 (fix(core): range check number exponents as DynamoDB does #619).ReturnConsumedCapacitynow comes ahead of the parameter mix. TheExpressionAttributeNameschecks, the numbers and the set checks come ahead ofSelect. A body with a value that the service cannot read as one type takes the order fix(query): check Query values against the key schema and the number rules #544 gives it. A null there is not a shape fault any more, and a number inSegmentorTotalSegmentsis not one either. The number check gets the raw map, and theLimitcheck uses theQuerytext.Query, with a wire test.What
Scannow checks theNvalues inExpressionAttributeValuesat request time. A filter on{"N": "bob"}, abobnested in anL, anMor anNS,1e200, a 39-digit value or an emptyNanswered 200 withCount: 0. Each now answers the service'sValidationExceptionbefore ExtendDB reads any row, whether or not an expression reads the value. The texts areThe parameter cannot be converted to a numeric value: bob, the overflow, underflow and 38-digit texts, andThe parameter cannot be converted to a numeric value:for an emptyN.The checks run in
validate_scan_request_body(crates/engine/src/scan_request.rs) on the raw request body, before ExtendDB deserializes the body and looks the table up. For a body whoseExpressionAttributeValuesthe service can read, they run in the order the service uses:Limit(at least 1),Segment(0 to 999999) andTotalSegments(1 to 1000000), each when present, the first fault in that orderReturnConsumedCapacityenumAttributesToGet,ScanFilter,ConditionalOperatoragainstProjectionExpression,FilterExpression)ExpressionAttributeNameschecks: an empty map, an invalid key and an empty nameExpressionAttributeValues, nested ones andNSmembers includedSelectenumAn invalid
Selectbeside an invalidReturnConsumedCapacityanswers theReturnConsumedCapacitytext alone, as on the service. Step 1 uses theLimittext thatQueryuses and theSegmentandTotalSegmentstexts of main. The service's range texts are #563, which #850 brings.The service cannot read some values as one type. These are a null,
{}, an unknown type descriptor, two descriptors, and a descriptor with a null payload, at anyLorMdepth. Beside such a value the service answers in another order, which #544 encodes inunreadable_value_checks. After the range checks, Scan calls that function. It reports an invalidSelectand an invalidReturnConsumedCapacitytogether, then checks the mix, the names and the values. The function now takes the mix check as an argument, so Scan passes its own members. So{"Select": "BAD", "ReturnConsumedCapacity": "BAD", "FilterExpression": "a = :a", "ExpressionAttributeValues": {":a": {}}}answers both enum texts in one message, as on the service and on main. A null besideSelect: "bad"answers theSelecttext.When a check fails, #544's
shape_fault_firstdeserializes each member of the body, and each value, on its own. Scan passes it the body fromreadable_for_shape_check, which replaces the parts of a value that the service cannot read. ASerializationExceptionfor a member of the wrong JSON type is then the answer, in any member order. A null value is not a shape fault. A number inLimit,SegmentorTotalSegmentsis not one either: the service readsSegment: 1.5andTotalSegments: 2.5besideSelect: "NOPE"and answers theSelecttext. A string that the service reads as a boolean inConsistentReadis not a shape fault since #544's round 2.The server runs
validate_scan_request_bodyinauthorize_request(crates/server/src/request_helpers.rs) beside theQuerycheck, after the cross-account refusal and before the IAM decision. A malformed Scan from a principal that may not Scan the table now gets the request'sValidationException, as on the service, where it gotAccessDeniedException. The checks read only the request body.The handler still makes the undefined value, unused value and filter syntax checks, after the request-time checks. It also makes the
Segmentpairing checks and theIndexName,ConsistentRead,SelectwithProjectionExpressionandExclusiveStartKeychecks. On the service the filter checks come ahead ofSelect. The pairing check comes ahead of the table lookup and the IAM decision there. #1391 tracks both.scan_request.rstakesLIMIT_BELOW_ONE, the two enum member lists,validate_names,validate_expression_attribute_value_numbers,unreadable_value_checks,readable_for_shape_check,shape_fault_firstandsorted_entriesfromquery_key_values.rs. Its own code is the Scan parameter mix, the range checks andvalidate_sets. That set check reads each value with theAttributeValuedeserializer and keeps theValidationExceptionit raises.Why
Scan served a filter on an
Nvalue that is not a number. The service refuses the request (#545).Closes #545
Differences that remain
SegmentandTotalSegmentswithout the value inside int32, and it reports every range fault in one message. Outside int32, for a float, or beside a value it cannot read, it uses an older form. That form names the value, saturated to int32, and gives the enum clauses in the same message. So{"Limit": 0, "ExpressionAttributeValues": {":x": {"X": "1"}}}answers theLimitValidationExceptionhere, as on the service, but with the newer text where the service answersValue '0' at 'limit'.{"Limit": 1.5, "Select": "BAD", "ReturnConsumedCapacity": "BAD"}answers theReturnConsumedCapacitytext alone here. The service and main answer both enum texts. Scan range constraints: the service aggregates Limit, Segment and TotalSegments faults and uses two text forms by the value's size #563 tracks these, and fix(scan): report every Limit, Segment and TotalSegments range fault in the service's two forms #850, stacked on this branch, completes the older form.Select, and the pairing check ahead of the table lookup and the IAM decision: Scan reports an invalid Select ahead of the filter checks, and the table lookup and the IAM decision ahead of the Segment pairing check #1391.The Segment parameter is zero-based and must be less than parameter TotalSegments. ExtendDB adds: Segment: 5 is not less than TotalSegments: 2(Scan: the Segment, ScanFilter value count and COUNT with AttributesToGet checks answer texts that differ from the service #838).ExpressionAttributeValues can only be specified when using expressionsahead of the values when the request has no expression (Scan and Query with an empty, two-member or unknown-type AttributeValue answer the parse error, where DynamoDB answers the values message #1169).{"FilterExpression": "a = :a OR a = :n", "ExpressionAttributeValues": {":a": {}, ":n": {"N": "bob"}}}names:non the service and:ahere (Two faults in one request map: ExtendDB can report another member than the service #1013). For a number fault beside a set fault in another value, the service named either value between two identical requests. ExtendDB names the number.Input collection [1, 1] contains duplicates.). The service lists none for anNSand quotes them for anSS(An SS or NS with duplicate members gets another duplicates text than DynamoDB's #1360) and aBS(A BS with two spellings of one value gets another duplicates text than DynamoDB's #1312).ConsistentReadthat the service reads as a boolean (A boolean member given as a JSON string is read differently from the service #984).ScanFilterand the emptyAttributesToGet(Scan request validation gaps: empty ScanFilter in the parameter mix, empty AttributesToGet, legacy and ExclusiveStartKey numbers, ExpressionAttributeValues nesting depth #564, which fix(scan): check AttributesToGet, ScanFilter, ExclusiveStartKey and ExpressionAttributeValues in the service's order #854 fixes)ScanFilterand inExclusiveStartKey(Scan request validation gaps: empty ScanFilter in the parameter mix, empty AttributesToGet, legacy and ExclusiveStartKey numbers, ExpressionAttributeValues nesting depth #564)ExpressionAttributeValues(Scan request validation gaps: empty ScanFilter in the parameter mix, empty AttributesToGet, legacy and ExclusiveStartKey numbers, ExpressionAttributeValues nesting depth #564)Selecttexts without the1 validation error detected:prefix (Scan Select rules and the Query ALL_PROJECTED_ATTRIBUTES rule answer without the "1 validation error detected: " prefix #832)Non the write paths and in comparisons (Unicode decimal digits in N values: refused on writes, compared as text on reads #565)Overlaps with other PRs
crates/server/src/handler.rs. feat(wasm): [Add WebAssembly browser support for ExtendDB #1009 on main moved the body parse ofhandle_requestintoextenddb_engine::parse_request, and fix(scan): report every Limit, Segment and TotalSegments range fault in the service's two forms #850 changes that parse.handle_scan. Whichever merges second drops its copy.query_scan_deserialize_error.shape_fault_firstmaps throughdeserialize_error. Whichever merges second uses the other's mapper.test_undefined_placeholder).git merge-treeof c06130a with the head of each open PR on 4 Dec:crates/engine/src/scan.rsconflicts with fix(expressions): validate in the service's order, with its messages #399, fix(query): check legacy conditions against the key schema #507, fix(expression): operator cap, syntax error wording, PutItem map keys #558, fix(engine): send the ConditionalOperator enum text alone on Query and Scan #1100 and fix(engine): answer a missing TableName, Key or Item as DynamoDB does #1262, as at 4c08c09 and 009c4c1. It conflicts there too with three PRs that sit on them: fix(mongodb): evaluate deeply nested conditions instead of answering 500 #571 on fix(expression): operator cap, syntax error wording, PutItem map keys #558, fix(core): refuse a document path of more than 32 elements #597 on fix(expressions): validate in the service's order, with its messages #399, and fix(core): report the first ProjectionExpression fault in written order #1140 on fix(core): refuse a document path of more than 32 elements #597. Their other conflicted files, among themquery.rsandkey_condition.rs, conflict with main too.crates/engine/src/query_key_values.rsconflicts with fix(query): check the numbers of KeyConditions and QueryFilter values #1364 in one line. This branch makes theunreadableimportspub(crate), and fix(query): check the numbers of KeyConditions and QueryFilter values #1364 adds an import beside them. The merge that comes second keeps both.Testing done
Measured on the service
Amazon DynamoDB in us-east-1, raw signed Scan requests with the members in the order written, each sent twice with the same answer both times. The 2026-11-23 and 2026-12-03 requests went to a table name that does not exist. The 2026-11-19 requests went to a table keyed on
pkandsk, both S. The rows of the DescribeTable role came from a role allowed onlydynamodb:DescribeTableon it.TableName)ReturnConsumedCapacity: "NOPE"beside a mix ofFilterExpressionwithScanFilter,AttributesToGetorConditionalOperatorReturnConsumedCapacitytext:n{"N": "bob"}beside the names{"a": "b"},{}or{"#a": ""}Select: "NOPE"beside a duplicate or emptyNS, a duplicateSSorBS, or a duplicateNSin anLNSor an emptyNSbeside:n{"N": "bob"}Select: "bad"beside a null,{"L": [null]}or{"S": null}SelecttextSelect: "BAD",ReturnConsumedCapacity: "BAD",:a{}Limit: 1.5,Select: "BAD",ReturnConsumedCapacity: "BAD"ScanFilter,FilterExpression,:x{"X": "1"}Limit: 0,:u{"X": "1"},Select: 5SerializationExceptionNUMBER_VALUE cannot be converted to StringSegment: 1.5,TotalSegments: 2,Select: "NOPE"SelecttextSegment: 0,TotalSegments: 2.5,Select: "NOPE"SelecttextFilterExpression: "a = :a OR a = :n",:a{},:n{"N": "bob"}ExpressionAttributeValues contains invalid value: The parameter cannot be converted to a numeric value: bob for key :n:n{"N": "1e9999999999"}and{"N": "1e-9999999999"}read by the filterSegmentandTotalSegmentsrows oftest_segment_ranges, each beside:n{"N": "bob"}1 validation error detected: Value at 'Segment' ...or... 'TotalSegments' ...Limit: 0,Segment: -1,TotalSegments: 1000001beside:n{"N": "bob"}Segment: 5,TotalSegments: 2Segment: 0,TotalSegments: 1ResourceNotFoundException, so the request passes the checksSelect: "bad"besideFilterExpression: "a = :undef"test_scan_checks_before_authorization.py, from the DescribeTable roleValidationExceptionof each bodyAccessDeniedException:n{"N": "bob"}read byFilterExpression: "a = :n", and the same value in a request with no expressionLimit: 0,ReturnConsumedCapacity: "NOPE", or the names{"a": "b"}besideFilterExpression: "attribute_exists(a)"Limit,ReturnConsumedCapacityor names textTests
crates/engine/src/scan_request/tests.rs: eight unit tests. The new rows sit in one data table,names_sets_and_unreadable_values_are_reported_in_the_measured_order, and each row asserts the full text by equality.cargo +1.97.0 test -p extenddb-engine --lib: 922 passed at ad5f485.tests/test_scan_number_values.py: 89 wire tests that run against either the service or ExtendDB. Where ExtendDB's text differs from the service's, the row has both and names the issue. The range rows, the pairing row, the duplicate set row and the{}besidebobrow do that.TestRequestOrderholds the new rows.test_two_bad_numbers_report_one_of_themstill accepts either value: the service's pick varied between two runs, and Two faults in one request map: ExtendDB can report another member than the service #1013 tracks its order.tests/test_scan_checks_before_authorization.py: one test that only ExtendDB runs. It sends nine malformed bodies as a user allowed onlyDescribeTable, then a valid body. Its account and user setup is theManagementPrincipalsbase class, whichtests/test_query_leading_keys_values.pynow shares..github/workflows/integration.ymlcollects both wire files in the jobsrun-integrationandrun-integration-sqlite.Controls
Each control put back one old line, or took out one new check, then ran the tests:
ReturnConsumedCapacityafter the mix: the mix unit test fails.SerializationException.Limitarm ofshape_fault_firstwithoutSegmentandTotalSegments: the table fails on itsSegment: 1.5row.cargo checkfails withE0308(it passes aHashMap<String, AttributeValue>where the function takes the raw map).Scanarm ofauthorize_requestremoved, the pairing check off, theSegmenttext changed, and the mix ahead ofReturnConsumedCapacity. Seven wire tests fail, each for its own change: the authorization test, twotest_segment_rangesrows, threetest_return_consumed_capacity_beats_parameter_mixrows and the pairing row. The other 83 pass.Gates
At c06130a, the head of this description:
cargo +1.97.0 fmt --all -- --check: clean..github/workflows/clippy.ymlwith-D warnings, on the whole workspace: no warnings.cargo +1.97.0 clippy -p extenddb-engine -p extenddb-server --all-targets -- -W clippy::pedantic: no warning on a line this PR adds.cargo +1.97.0 test --lib -p extenddb-engine -p extenddb-server: the engine gives 989 passed. The server gives 521 passed and 5 failed. The five are thebackup_storetests that fail on this host only, as the block of 6f722f7 says.cargo +1.97.0 test -p extenddb-wasm-adapter: 3 passed, and theparitycorpus test passed.cargo +1.97.0 test -p extenddb-storage-postgres --test doc_version_literals: 3 passed.tests/test_query_leading_keys_values.pyhold 92 tests. Against a SQLite and a PostgreSQL server built from c06130a, 92 passed on each.tests/test_scan_segments.pyandtests/test_read_paging.py, withtests/test_query_scan.py,tests/python/test_query_scan.pyandtests/python/test_scan_edge_cases.py, passed 220 tests on each of the two servers.python3 -m pytest --collect-only -qcollects 7431 tests intests/and 820 intests/pythonwith no error.At 4c08c09:
cargo +1.97.0 fmt --all -- --check: clean..github/workflows/clippy.ymlwith-D warnings, on the whole workspace: no warnings.cargo +1.97.0 clippy -p extenddb-engine -p extenddb-server --all-targets -- -W clippy::pedantic: no warning on a line this PR adds.cargo +1.94.0 check -p extenddb-engine -p extenddb-server --all-targets: no warnings. 1.94.0 is therust-versionof main.cargo +1.97.0 test --lib -p extenddb-engine -p extenddb-server: the engine gives 989 passed. The server gives 521 passed and 5 failed. The five are thebackup_storetests that fail on this host only, as the next block says.cargo +1.97.0 test -p extenddb-wasm-adapter: 3 passed, and theparitycorpus test passed. The clippy step of.github/workflows/wasm.ymlis clean.cargo +1.97.0 test -p extenddb-storage-postgres --test doc_version_literals: 3 passed.Querywire files of fix(query): check Query values against the key schema and the number rules #544 hold 419 tests. Against a SQLite and a PostgreSQL server built from 4c08c09, 419 passed on each.python3 -m pytest --collect-only -qcollects 7394 tests intests/and 820 intests/pythonwith no error.At 6f722f7:
cargo +1.97.0 fmt --all -- --check: clean.cargo +1.97.0 clippy -p extenddb-engine -p extenddb-server --all-targets -- -D warnings, with and without--features extenddb-engine/backup-test-hooks: no warnings.cargo +1.97.0 clippy ... -W clippy::pedantic: no warning on a line this PR changes.cargo +1.91.1 check -p extenddb-engine -p extenddb-server --all-targets: no warnings.cargo +1.97.0 test -p extenddb-server: 513 passed. Fivebackup_storetests fail on this host only, because/local/homebelongs to uid 65534 and the spool checks refuse a directory under it. This PR does not change that file.Querywire files of fix(query): check Query values against the key schema and the number rules #544 against a SQLite server built from 6f722f7: 401 passed.At ad5f485, the merge of #544's third round:
cargo +1.97.0 fmt --all -- --check: clean.cargo +1.97.0 clippy -p extenddb-core -p extenddb-engine -p extenddb-server --all-targets -- -D warnings, and-p extenddb-enginewith--features extenddb-engine/backup-test-hooks: no warnings.cargo +1.91.1 check -p extenddb-core -p extenddb-engine -p extenddb-server --all-targets: no warnings.cargo +1.97.0 test -p extenddb-engine --lib: 922 passed.python3 -m pytest --collect-only -qcollectstests/(7010) andtests/python(672) with no error.The production code adds 267 lines and removes 102, and the tests add 1,238 lines and remove 7. The upgrade manual entry adds 19 lines.
Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a. There is no wire,
Storagetrait, auth model or on-disk change.Breaking changes
A client sees the service's answers for some Scan requests that ExtendDB answered another way:
Nvalue inExpressionAttributeValuesthat is not a number gets a 400ValidationException. A filtera = :nwith{"N": "bob"}got 200 withCount: 0, andResourceNotFoundExceptionon a table that does not exist.Limit0 gets1 validation error detected: Value at 'Limit' failed to satisfy constraint: Member must have value greater than or equal to 1, the text ofQuery. It gotValue '0' at 'limit'in that text, andResourceNotFoundExceptionon a table that does not exist.ValidationException, where it gotAccessDeniedException.ValidationExceptionthan before, in the order above.The v1.2.0 entry of
docs/manuals/07-upgrade-manual.mdlists these changes.By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.