Repository navigation
fix(core): read a B value with its padding left out or cut short - #1313
LeeroyHannigan wants to merge 16 commits into
Conversation
ExtendDB decoded a B value or a BS member with a decoder that requires the "=" padding. It refused YQ, YQ=, YWJjZA and YWJjZA= with a SerializationException. DynamoDB reads them, in an item and in an expression attribute value, and stores the bytes of the padded value. It refuses them in a PartiQL parameter, with the text of their length. DynamoDB refuses a value whose last character carries bits outside a whole byte, such as YR or YWJ, in both places. Measured in us-east-1 on 21 Nov 2026. decode_base64 now decodes with a padding mode that accepts the padding left out or cut short, and keeps the texts of a refusal. decode_padded_base64 keeps the decoder that requires the padding, and the checks of the PartiQL parameters call it. Both share one mapping of a refusal to its text. A value with "=" inside, such as Y=Q=, is #1307. Fixes #1258.
ImportTable reads each line of a DYNAMODB_JSON file with the attribute value deserializer of the requests. The previous commit makes that deserializer read a B value with its padding left out or cut short. So ImportTable read the B value YQ as the byte 0x61, where it refused the line before. DynamoDB's ImportTable refuses those values. Two imports of the same 18 files on 2026-11-22, one item per file, gave the same answers. Each import took the item whose B value is YQ==. It refused the items with these B values: YQ, YQ=, Y=Q=, =YQ=, Y-Q=, =A==, YWJjY=Q=, Y=Q, =Y==, =YQA, "Y Q=", Y, == and "Y=Q=\n". It also refused the BS values [Y=Q=, //Q=], [Y=Q=, =YQ=] and [YQ, YQ==]. Each import ended FAILED with ItemValidationError, ImportedItemCount 1 and ErrorCount 17. read_dynamodb_json now refuses a line with a B value or a BS member that is not canonical padded base64. This applies at any depth inside M and L values. The answer is the one the line had before the previous commit: Invalid DynamoDB item at line N. The imports measured values at the top level of the item only. Requests keep the new reading. Refs #1258.
An earlier commit of this branch makes the attribute value deserializer read a B value with no padding or with part of its padding. BatchWriteItem reads its request with that deserializer. So it accepted the B value YQ in a PutRequest item and in a DeleteRequest key, where it refused the value before. DynamoDB's BatchWriteItem reads a B value or a BS member only with its padding. Measured in us-east-1 on 2026-11-22, each request twice. The B value YQ in a PutRequest item gave a SerializationException. Its text was "Base64 encoded length is expected a multiple of 4 bytes but found: 2". YQ= gave the same text with 3, and the BS value [YQ] gave it with 2. The DeleteRequest key YQ and the PutRequest key Yg gave it with 2 too. BatchGetItem, TransactGetItems, GetItem, DeleteItem, TransactWriteItems and UpdateItem read the key or value YQ as the byte 0x61. handle_batch_write_item now checks the raw RequestItems with decode_padded_base64 ahead of the deserializer. That is the decoder of the PartiQL parameters. The answer is a SerializationException with the text of that decoder. The walk covers the RequestItems member only, and the deserializer reads the rest of the body as before. The walk over a body's B texts is the one the previous commit added for ImportTable. It moves to extenddb_core::types as check_binaries and takes the decoder as a parameter. ImportTable keeps the standard decoder. The requests of the other operations keep the deserializer's reading. Refs #1258.
The one conflict is the pub use line of crates/core/src/types/mod.rs. The merge keeps the exports of both sides.
The base merges #544's branch and adds the rows "//==" and "++==" to the decoder tests. Three conflicts come from these rows and their dates: - The row count of a_value_that_is_not_base64_gets_the_service_text in crates/core/src/types/attribute_value.rs. This branch adds 6 rows and the base adds 2, so the table now has 56. Its doc comment gives the dates of both sides. - The comment over the B and BS parameter rows in crates/core/src/partiql/params.rs. The merge keeps the base's three dates and this branch's sentence about the padding. - The docstring of tests/test_binary_base64.py. The merge keeps this branch's sentence about the padding and gives the three dates.
The doc comment of import_reads_a_binary_only_in_the_canonical_form says that the rows with YQ inside an M and an L were not measured. It now also gives the reason for their expected answer. The import reads a B value with the standard decoder at any depth, so these rows get the answer of the top-level YQ row.
navareamol
left a comment
There was a problem hiding this comment.
I think the BatchWriteItem check reads more than the attribute values. check_binaries(&body["RequestItems"], decode_padded_base64) decodes any string under a member named B, and any string in an array under BS, anywhere in RequestItems. WriteRequest, PutRequest and DeleteRequest skip members they do not model, so the check now decodes members the deserializer never reads. I sent {"RequestItems": {"<table>": [{"PutRequest": {"Item": {"pk": {"S": "nb"}}, "B": "x"}}]}} to SQLite builds. main at aff626e and #1260 at 639ff59 answer 200 and write the item. 05c9baf, and 05c9baf merged with main, answer SerializationException Buffer is too short for base64 encoding. "BS": ["x"] beside PutRequest and "B": "x" beside Key in a DeleteRequest get the same answer, and "B": "YQ" beside Item gets Base64 encoded length is expected a multiple of 4 bytes but found: 2. PutItem with an unknown top level "B": "x" is served on every build. The doc comment says "Matching member names is safe: a value that deserializes holds attribute values there, and any other value is refused", which does not hold for these members. Has anyone checked what DynamoDB answers for an unknown member in a WriteRequest? If it ignores it, as main does, this is a regression. Could the check walk only PutRequest.Item and DeleteRequest.Key of each list, value by value?
The same walk changes the answer for three malformed items, where main gives the deserializer's answer:
{"BS": [{"B": "YQ"}]}: main and #1260 answer ValidationExceptionSupplied AttributeValue is empty, must contain exactly one of the supported datatypes, as PutItem does on this head. BatchWriteItem on this head answers SerializationException with the length text. The description says the walk reads everyBtext "as the deserializer does", butbinary_setdoes not decode aBinside aBSmember.- An item attribute
"B": "YQ", a string where a value belongs: main answersStart of structure or map found where not expected: invalid type: string "YQ", ..., as PutItem does. BatchWriteItem on this head answers the length text. {"pk": {"S": 1}, "v": {"B": "YQ"}}: main and #1260 name the first fault (S value must be a string), and this head names the laterB. Was a request with an earlier fault of the wrong JSON type among the BatchWriteItem measurements? If not, could one be measured, since the description says the service refuses the padding "ahead of the rest of the request"?
Walking only the attribute values, and decoding only the string members of a BS, would leave the first two to the deserializer.
The wasm check on this head fails with E0308 at crates/core/src/metrics/collector.rs:60, the error main had at 14ade59 before #1482. 05c9baf merges with current main (aff626e) with no conflict. On that merge a workspace cargo check of all targets, clippy on core and engine, fmt, and the core (1243), engine (980) and wasm adapter tests pass, and tests/test_binary_base64.py with five other wire files passes on SQLite. Could you merge main so CI runs on it?
I will approve once the BatchWriteItem check reads only the item and key values (or DynamoDB is shown to refuse an unknown B member) and CI is green on a branch with current main.
Add a v1.2.0 entry at the top of "Behavior Changes by Release" in docs/manuals/07-upgrade-manual.md, above the entries of main and #1260. It gives the values that 1.1.0 refused and this branch reads, the bytes they store, and the requests that still need the padding.
Add a v1.2.0 entry at the top of "Behavior Changes by Release" in docs/manuals/07-upgrade-manual.md, above the entry of #1313. It gives the values with "=" or another character inside that 1.1.0 refused and this branch stores. It also gives the texts of the values that DynamoDB refuses, the BS duplicates text and the echo of a long PartiQL list.
The base brings main at c8e66fb through #1260, with #1465, #1515 and #1411, and adds the v1.2.0 entry of #1313 to docs/manuals/07-upgrade-manual.md. Git merged the manual with no conflict. The order of the v1.2.0 entries is #1313, #1411, #606, #1260, then the entry of this branch. No other file has changes on both sides.
|
I think a fault inside one value still loses to a B without padding in the same value. The doc comment of
Your live measurements cover the attributes of one item, S 1 then B and B then S 1, and show the service reading the item in request order. I think it reads inside a value in order too, which would make these four a change from main with no measurement behind it. Have you measured one of them on the service, for example the first row on a table that does not exist? If the service reports the first fault inside a value, The three other points are resolved on my side.
On the head I ran: core, engine and wasm adapter unit tests, clippy and fmt, the six wire files with your test file and my attack file on SQLite (1224 passed), 827 probes with no 5xx and no panic, requests of 25 items of 380 KB and a BS of 100000 members (under one second, same as main), and the PartiQL parameters, ExecuteTransaction and ImportTable paths. I found nothing else. I will approve once the nested order is measured or settled, and the pending checks finish green. |
Inside one value, the padding check of BatchWriteItem reported a B
without its padding ahead of an earlier fault of the wrong JSON type.
For example, {"S": 1} ahead of {"B": "YQ"} in an M or an L got the
length text of YQ. So did an object or a number ahead of "YQ" in a BS.
DynamoDB reads inside a value in request order and reports the first
fault (measured 2026-12-03, each body twice, on a table that does not
exist):
- {"M": {"a": {"S": 1}, "b": {"B": "YQ"}}} and the same two values in
an L get "NUMBER_VALUE cannot be converted to String". With the B
first, both get the length text of YQ.
- {"BS": [{"B": "YQ"}, "YQ"]} gets "Start of structure or map found
where not expected". {"BS": [1, "YQ"]} gets "only base-64-encoded
strings are convertible to bytes".
- An SS member of another JSON type in a value ahead of the B gets
"NUMBER_VALUE cannot be converted to String".
- The read does not stop at an unknown type descriptor or a second
type descriptor ahead of the B. It does not stop at a null payload or
a null member of a BS or an L either. The B gets the length text of
YQ.
These are the rules of check_parameter_types, the first pass of the
PartiQL parameter checks (measured 2026-11-06). padding_refusal now
reads each value of written_values with it. It keeps a base64 refusal
and leaves every other fault to the deserializer. This replaces
check_binaries and shape_fault in BatchWriteItem, and shape_fault is
private again, as on main.
The 15 measured rows join
batch_write_item_checks_the_padding_of_the_items_and_keys_alone. The
five rows with a fault ahead of the B expect the answer of a PutItem of
the same item, as m4 to m6 do. The texts of the deserializer differ
from the texts of DynamoDB there (#1104, #1012).
…anges The v1.2.0 entry of this PR now says which BatchWriteItem answers change from 1.1.0. A B without its padding gets the length text beside a second type descriptor, and after an unknown type descriptor or a null. 1.1.0 refused such a request for the other value. A fault of the wrong JSON type ahead of the B keeps its 1.1.0 answer. DynamoDB gives these answers (measured 2026-12-03, each body twice, on a table that does not exist).
… the other fault The v1.2.0 entry said that 1.1.0 refused such a request for the other value. Beside a second type descriptor, the other fault is in the same value. So the entry now says that 1.1.0 answered with the text of the other fault. The PR body gives the same wording.
The base brings a new BatchWriteItem check. It reads a fault ahead of a B in request order, also inside a value. The base also adds a sentence to its v1.2.0 entry. The merge has no conflict. Git merged two files with changes on both sides at other lines: - padding_tests.rs: the new rows and comment of the base, and row w3 of this branch. - the upgrade manual: the new sentence in the entry of #1313, and the entry of this branch above it.
The base brings a new BatchWriteItem check. It reads a fault ahead of a B in request order, also inside a value. The base also adds a sentence to its v1.2.0 entry. The merge has no conflict. Git merged the upgrade manual, where both sides changed other lines. The base adds the new sentence to the entry of #1313. This branch has its entry below the entry of #1260. No other file has changes on both sides.
The base brings the BatchWriteItem check of #1313 that reads a fault ahead of a B in request order, also inside a value. It also brings the new sentence of the v1.2.0 entry of #1313 and the new Python test of #1355. One file conflicted: crates/engine/src/batch_write_item.rs, in the import list. The base drops AttributeValue, check_binaries and decode_padded_base64 and adds is_base64_refusal. The resolution also keeps first_duplicates_as_sent and is_listed_duplicates of this branch. Git merged padding_tests.rs, query_key_values.rs and the upgrade manual at other lines.
|
Measured on 3 December 2026 with BatchWriteItem, each body twice, on a table that does not exist. In rows 1, 2 and 4, the value sat in an item after
Two more items: These are the rules of
The new head is 835b5ae. |
|
The mongodb-rust job failed on 835b5ae. The failing test is The nested order is resolved on my side. The entry in docs/manuals/07-upgrade-manual.md says 1.1.0 refused such a request with the text of the other fault. I built tag v1.1.0 and sent the rows to BatchWriteItem on an existing table. n10, n11 and n12 answer One question that I will not hold the approval on. Main has moved since this branch was cut. A merge of current main (c057660) conflicts in docs/manuals/07-upgrade-manual.md, because #1446 added an entry just above the #1411 entry. This shows when the stack lands. I will approve once mongodb-rust is green on a rerun and the three pending checks finish green. |
The base merges main at b6c8595, which brings #1446, #1531 and #1466. The base also adds 15 rows to tests/test_binary_base64.py. One file conflicted: docs/manuals/07-upgrade-manual.md. #1446 and #1531 add two v1.2.0 entries at the top of "Behavior Changes by Release", where this branch adds its entry. The merge keeps the three entries: the two entries of main first, then the entry of this branch, above the entry of #1411. Git merged tests/test_binary_base64.py at other lines. It holds the new rows of the base and the rows of this branch. No other file has changes on both sides.
The base brings main at b6c8595 through #1260, with #1446, #1531 and #1466. It also brings the 15 new rows of #1260 in tests/test_binary_base64.py. One file conflicted: docs/manuals/07-upgrade-manual.md. #1446 and #1531 add two v1.2.0 entries at the top of "Behavior Changes by Release", where this branch adds its entry. The merge keeps the two entries of main first, then the entry of this branch, then the entry of #1313. Git merged tests/test_binary_base64.py at other lines. No other file has changes on both sides.
The base brings main at b6c8595 through #1260, with #1446, #1531 and #1466, and the 15 new rows of #1260 in tests/test_binary_base64.py. The merge has no conflict. Git merged the upgrade manual, where both sides changed other lines. The base adds the two entries of main above the entry of #1313, and this branch has its entry below the entry of #1260. No other file has changes on both sides.
The base brings main at b6c8595 through #1260 and #1313, with #1446, #1531 and #1466. It also brings the 15 new rows of #1260 in tests/test_binary_base64.py. One file conflicted: docs/manuals/07-upgrade-manual.md. #1446 and #1531 add two v1.2.0 entries at the top of "Behavior Changes by Release", where this branch adds its entry. The merge keeps the two entries of main first, then the entry of this branch, then the entry of #1355. No other file has changes on both sides.
|
@navareamol The mongodb-rust rerun passed: run 47064403631, attempt 2. All 72 checks on 835b5ae passed, and that includes the three that were pending. f7f1849 merges the new head of #1260, which merges main at b6c8595. The upgrade manual conflicted, as you said. The merge keeps the two entries of main first, then the entry of this PR, above the entry of #1411. The checks run again on this head. No measurement on the service covers |
navareamol
left a comment
There was a problem hiding this comment.
Nothing in the code of this PR changed since 835b5ae. Between that head and f7f1849 the only file under crates or tests that differs is tests/test_binary_base64.py, which gains the 15 rows of #1260. The rest of the diff is main, merged through #1260.
I ran the engine tests with the filter padding on this head and they pass, including rows n1 to n15. With the production files batch_write_item.rs and query_key_values.rs put back to 3aadd30, the same test fails on n1, n2, n5, n6, n13, n14 and n15, which is your list of seven. On a SQLite build of this head, 1169 wire tests passed, among them test_binary_base64.py with the new rows. Your service answers for these rows are your measurements and I did not repeat them.
The mongodb-rust failure is settled. Run 47064403631 attempt 2 on 835b5ae shows mongodb-rust as success. The upgrade manual at this head lists the Cassandra entry, the MongoDB entry, this PR's entry and the DeleteTable entry in that order, with no conflict markers.
The question about a null member of an M stays open. You wrote that no measurement covers it and that n7 and n15 got the length text, so I do not hold the approval on it.
Main moved again to 5826e1b (#1087), and docs/manuals/07-upgrade-manual.md conflicts with it at the top of the release list. It does not hold this PR, and the stack can fix it when it lands.
All 70 checks pass on f7f1849, so I approve.
Changes since the last review
tests/test_binary_base64.py. One file conflicted:docs/manuals/07-upgrade-manual.md. fix(storage-mongodb): keep a DELETING table's tags until its document goes #1446 and fix(storage-cassandra): retry a lost UpdateItem version check over the PutItem and DeleteItem window #1531 add two v1.2.0 entries at the top of "Behavior Changes by Release", where this PR adds its entry. The merge keeps the two entries of main first, then the entry of this PR, above the entry of fix(engine): describe a DELETING table with the members the service keeps #1411. Git mergedtests/test_binary_base64.pyat other lines, and the file now has 69 rows. No other file has changes on both sides.cargo +1.97.0 fmt --all -- --checkis clean..github/workflows/clippy.ymlwith-D warningsare clean onextenddb-coreandextenddb-engine.tests/test_binary_base64.py,tests/test_attribute_value_validation.pyandtests/test_batch_write_validation_order.pypassed 245 tests.python3 -m pytest --collect-only -qcollects 7373 tests intests/and 820 intests/pythonwith no error.cargo +1.94.0 check, the wasm-adapter tests and the WebAssembly clippy step pass there too.What
ExtendDB now reads a
Bvalue or aBSmember with no=padding or with part of it. It reads such a value in an item, a key and an expression attribute value, as DynamoDB does. The value must not carry bits outside a whole byte in its last character. The stored bytes are those of the padded value. A PartiQL parameter and a BatchWriteItem request still need the padding, as DynamoDB requires.decode_base64incrates/core/src/types/attribute_value.rsdecodes withDecodePaddingMode::Indifferent.decode_padded_base64keeps the decoder that requires the padding. The PartiQL parameter checks incrates/core/src/partiql/params.rscall it.crates/engine/src/partiql/request_checks/echo.rskeeps its decoder, which requires the padding.check_binariesincrates/core/src/types/attribute_value.rswalks one attribute value, with the values of itsMandL. It gives the first refusal of a decoder for aBtext or a string member of aBS. It leaves every other payload to the deserializer. ImportTable calls it with the standard decoder.handle_batch_write_itemincrates/engine/src/batch_write_item.rsrunspadding_refusalbefore the deserializer.padding_refusalreadswritten_valueswithcheck_parameter_typesofcrates/core/src/partiql/params.rs, which decodes withdecode_padded_base64.written_valuesare the attribute values of eachPutRequestItemand eachDeleteRequestKey, in the order the deserializer reads them. ABvalue or aBSmember without its padding gets theSerializationExceptionof that decoder. A fault of the wrong JSON type ahead of it, also inside its value, comes first, from the deserializer.read_dynamodb_jsonincrates/engine/src/import_export_io.rsrunscheck_binarieswith the standard decoder on each value of the item. It refuses aDYNAMODB_JSONline with aBvalue or aBSmember that this decoder does not read. Such a line getsInvalid DynamoDB item at line N, its answer before this PR.check_parameter_typeswalks the same shapes ascheck_binariesand stops at a fault of another JSON type. ImportTable keepscheck_binaries, because it needs the standard decoder. With #1355,decode_padded_base64also reads values such asY=Q=, which the import of DynamoDB refuses. A decoder parameter oncheck_types, the walk ofcheck_parameter_types, would change a function that #1103 and #781 move tocrates/core/src/serde_helpers.rsand that #1418 and #1437 call.The base of this PR is #1260, which changes the same decoder.
Why
Fixes #1258
These are DynamoDB's answers, measured in us-east-1 on 21 November 2026 with signed requests. Each request went out twice and got the same answer both times. The PutItem rows used an on-demand table that the measurement created and then deleted, and a consistent GetItem read each stored value back. The ExecuteStatement and Query rows named a table that does not exist, so a value that DynamoDB reads gets
ResourceNotFoundException. LENGTH(n) isSerializationException,Base64 encoded length is expected a multiple of 4 bytes but found: n.{"B": "YQ"}YQ==YQ=={"B": "YQ="}YQ==YQ=={"B": "YWJjZA"}YWJjZA==YWJjZA=={"B": "YWJjZA="}YWJjZA==YWJjZA=={"B": "YWI"}YWI=YWI={"BS": ["YQ", "Yg"]}["YQ==", "Yg=="]["YQ==", "Yg=="]{"B": "YR"}{"B": "YWJ"}{"B": "YQ"}as an expression attribute valueResourceNotFoundExceptionResourceNotFoundException{"B": "YQ"}as a parameter{"B": "Y=Q="}//Q=SerializationExceptionwith no messageEvery measured value gets DynamoDB's answer and stored bytes, except these:
=inside, such asY=Q=and=YQ=(A B value with "=" inside, such as Y=Q=, gets SerializationException, where DynamoDB stores bytes for it #1307).{"BS": ["Yg==", "Yg"]}: both refuse it as a set with duplicates, with other texts (A BS with two spellings of one value gets another duplicates text than DynamoDB's #1312). On fix(core): send DynamoDB's text for a B value that does not decode #1260, ExtendDB refusedYgwith LENGTH(2).DynamoDB's BatchWriteItem reads a
Bvalue or aBSmember only with its padding. The BatchWriteItem requests went out on 22 November 2026, in the same way as the requests above.{"B": "YQ"}in a PutRequest item or a DeleteRequest key got LENGTH(2), and so did{"BS": ["YQ"]}in a PutRequest item.{"B": "YQ="}got LENGTH(3). BatchGetItem, TransactGetItems, GetItem, DeleteItem, TransactWriteItems and UpdateItem read the key or valueYQas the byte 0x61. This PR gives each of these answers.The service reads only the items and keys of a BatchWriteItem, in request order. These requests went out on 2 December 2026, each twice, on a table that does not exist:
RequestItems{"PutRequest": {"Item": {"pk": {"S": "nb"}}, "B": "x"}}ResourceNotFoundException{"PutRequest": {"Item": {"pk": {"S": "nb"}}}, "BS": ["x"]}ResourceNotFoundException{"DeleteRequest": {"Key": {"pk": {"S": "nb"}}, "B": "x"}}ResourceNotFoundException"v": {"BS": [{"B": "YQ"}]}SerializationExceptionStart of structure or map found where not expectedValidationExceptionSupplied AttributeValue is empty, must contain exactly one of the supported datatypes(#1104)"B": "YQ"SerializationExceptionUnexpected value type in payloadSerializationExceptionwith the text of serde (#1012){"pk": {"S": 1}, "v": {"B": "YQ"}}SerializationExceptionNUMBER_VALUE cannot be converted to StringSerializationExceptionStart of structure or map found where not expected: S value must be a string(#1012){"a": {"B": "YQ"}, "pk": {"S": 1}}PutItem answers the three items of the wrong JSON type as BatchWriteItem does, on DynamoDB and on ExtendDB. The item
{"v": {"B": "YQ"}, "pk": {"S": 1}}gets LENGTH(2) from DynamoDB. A build with the MongoDB crate keeps the order of a JSON map, so there the walk reachesvfirst and gives LENGTH(2) too. No test runs that order. A build without the MongoDB crate reads the members in name order and reports theSfault.The service also reads inside a value in request order. These requests went out on 3 December 2026 in the same way. Unless a row gives the item, the item is
{"pk": {"S": "k"}, "v": VALUE}.{"M": {"a": {"S": 1}, "b": {"B": "YQ"}}}, and the two values in anLSerializationExceptionNUMBER_VALUE cannot be converted to StringSerializationExceptionStart of structure or map found where not expected: S value must be a string(#1012){"M": {"a": {"B": "YQ"}, "b": {"S": 1}}}, and the two values in anL{"BS": [{"B": "YQ"}, "YQ"]}SerializationExceptionStart of structure or map found where not expectedValidationExceptionSupplied AttributeValue is empty, must contain exactly one of the supported datatypes(#1104){"BS": [1, "YQ"]}SerializationExceptiononly base-64-encoded strings are convertible to bytesValidationException(#1104){"BS": [null, "YQ"]}and{"BS": ["YQ", 1]}{"a": {"X": "y"}, "v": {"B": "YQ"}}{"B": "YQ", "S": "x"},{"S": "x", "B": "YQ"}and{"M": {"a": {"B": "YQ", "NULL": true}}}"u": {"S": null}or"u": {"L": [null]}ahead of"v": {"B": "YQ"}"u": {"SS": [1]}ahead of"v": {"B": "YQ"}SerializationExceptionNUMBER_VALUE cannot be converted to StringValidationExceptionOne or more parameter values were invalid: An string set may not have a null string as a member(#1104)These are the rules of
check_parameter_types, the first pass of the PartiQL parameter checks (measured on 6 November 2026). It reads the members in order. It passes over a member that the model does not name, a null payload, and a null member of aBS, anMor anL. It stops at a member of the wrong JSON type, also inside a set. On 3aadd30 the check gave LENGTH(2) to the first, third and fourth rows and to theSSitem. The null items got the answer of the deserializer.DynamoDB's ImportTable reads a
Bvalue only in the canonical padded form. Two imports of the same 18 S3 objects, one item each, on 22 November 2026, gave the same answers. Each import took the item with{"B": "YQ=="}. It refused the 17 others, among them{"B": "YQ"},{"B": "YQ="}and{"BS": ["YQ", "YQ=="]}. Each import ended FAILED withItemValidationError. Without the import check, this PR would make ExtendDB importYQandYQ=. On a SQLite build of e030be2, a file with theYQline gotValidationExceptionandInvalid DynamoDB item at line 1. ExtendDB imported a file with theYQ==line.Overlap with #1418 and #1437
#1418 adds
check_base64incrates/core/src/types/attribute_value.rs, and #1437, whose base is #1418's branch, keeps it.check_base64is a walk that decodes eachBandBStext of a value at any depth.check_binariesin this PR does the same walk, with the decoder as a parameter. Whichever of the two stacks merges second reuses the walk of the other. This PR came first: it opened on 21 November, and #1418 on 24 November.Conflicts
git merge-treeshows no conflict with origin/main. #781 conflicts with main and with #1260 inparams.rs, and #1103 with #1260. The lines of this PR that calldecode_padded_base64are inside those hunks. A resolution keeps them.The v1.2.0 entry of this PR sits at the top of "Behavior Changes by Release" in
docs/manuals/07-upgrade-manual.md. Only the two entries of main that #1446 and #1531 add are above it. Other open PRs add their entries at the top too, so a merge with any of them conflicts there. #1110, #1114 and #1126 add theirs below the entry of #1260, and conflict there. Whichever PR merges second keeps both entries.This PR adds one conflict in the code:
let started = Instant::now();as the first statement ofhandle_batch_write_item, where this PR adds the check. The resolution keeps both lines.Not in this PR
Bvalue with=inside (A B value with "=" inside, such as Y=Q=, gets SerializationException, where DynamoDB stores bytes for it #1307).BSwith two spellings of one value (A BS with two spellings of one value gets another duplicates text than DynamoDB's #1312).Testing done
All runs below are on e030be2, before the merges of #1260's new heads, unless a line names another tree. "Changes since the last review" gives the runs on the commits since the last review.
cargo +1.97.0 test -p extenddb-core --no-fail-fast: 1147 unit tests passed and 1 is marked ignored. The integration and doc tests passed.cargo +1.97.0 test -p extenddb-engine --lib: 930 passed. The first run of the crate had one failure, the backup timing testa_stopped_heartbeat_timer_stops_the_restore_before_its_next_write, which this PR does not change. It passed in the second run.cargo +1.97.0 clippy -p extenddb-core -p extenddb-engine --all-targets -- -D warnings, the same forextenddb-enginewith--features extenddb-engine/backup-test-hooks, the same forextenddb-corewith--no-default-features,cargo +1.91.1 check -p extenddb-core -p extenddb-engine --all-targetsandcargo +1.97.0 fmt --all -- --checkare clean.cargo +1.97.0 clippy --locked -p extenddb-wasm-adapter --lib --release --target wasm32-unknown-unknown -- -D warnings, is clean.a_value_that_is_not_base64_gets_the_service_textfails atYQanda_value_of_the_wrong_json_type_is_found_ahead_of_any_other_problemfails atAQ=.batch_write_item_alone_reads_a_binary_only_with_its_paddingsends 12 of the measured requests through the engine. Without the BatchWriteItem check, its 5 BatchWriteItem rows with a value that has no full padding fail.import_reads_a_binary_only_in_the_canonical_formpasses. Without the ImportTable check, it fails atYQ,YQ=and the two nested rows.tests/private_modes.rshas the same context, but that test binary holds one test by design, because it sets the umask to 0. The other engine test contexts run no migrations, so CreateTable fails on them.tests/test_binary_base64.pyandtests/test_attribute_value_validation.pypassed 217 tests. The six PartiQL wire files (test_partiql_batch.py,test_partiql_grammar.py,test_partiql_key_conditions.py,test_partiql_requests.py,test_partiql_transaction.py,test_partiql_write.py) passed 1976, with 3 skipped and 2 marked xfail.tests/test_query_value_shapes.pyandtests/test_query_leading_keys_values.pypassed 115.tests/test_binary_base64.pyfail: the 4 PutItem rows and the Query row whose values do not have their full padding.Y=Q=and=YQ=(A B value with "=" inside, such as Y=Q=, gets SerializationException, where DynamoDB stores bytes for it #1307) and{"BS": ["Yg==", "Yg"]}(A BS with two spellings of one value gets another duplicates text than DynamoDB's #1312).Y=Q=in a PutRequest item, which DynamoDB stores (A B value with "=" inside, such as Y=Q=, gets SerializationException, where DynamoDB stores bytes for it #1307).DYNAMODB_JSONlines got the same answer from the import on main and on fix(core): read a B value with "=" or another character inside #1355's branch with this PR's ImportTable check merged. Without the check, 203 of them got another answer.The line counts count the Python files and the Rust lines of an inline test module as tests. At f7f1849 against #1260's head 5885e20: production +135 -10, tests +311 -10, and 8 lines of the upgrade manual. The commit 6b21d47 is production +89 -37 and tests +64 -12, and 7dfea6a is production +19 -23 and tests +31 -11.
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
Breaking changes
In an item, a key and an expression attribute value, ExtendDB now reads a
Bvalue or aBSmember without its full=padding. Before, it refused such a value with a SerializationException. A PartiQL parameter and ImportTable keep their answers. BatchWriteItem keeps its refusal of such a value. It now gives that refusal also beside a second type descriptor, and after an unknown type descriptor or a null. 1.1.0 refused such a request with the text of the other fault. The stored data does not change. The v1.2.0 entry ofdocs/manuals/07-upgrade-manual.mdgives 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.