Repository navigation
fix(engine): refuse the TableClass and SSESpecification DynamoDB refuses - #1114
LeeroyHannigan wants to merge 13 commits into
Conversation
CreateTable created a table for an SSEType of AES256 or outside its set, and for an SSEType with Enabled false. It also created one for a KMSMasterKeyId without an SSEType. It did not check the limit of 2048 characters on KMSMasterKeyId, or a TableClass outside its set. UpdateTable answered a TableClass outside its set with the table lookup or the BillingMode fault. DynamoDB refuses each of these requests with ValidationException. The answers were measured in us-east-1 on 13, 14 and 18 Nov 2026. DynamoDB reads the body and checks the table name length first. Then it answers the table class fault ahead of every member fault, and on UpdateTable ahead of the table lookup. ExtendDB now checks in this order, except for UpdateTable's name length (#1109). The BillingMode check still runs before the read, so the table class fault takes its place there. CreateTable now lists an SSEType outside its set and a KMSMasterKeyId of more than 2048 characters with the other member faults. It counts the key in characters. The order is the GSIs, then the key, then the SSEType, then the stream view type, then the LSIs. After the other checks it refuses an SSEType of AES256, and an SSEType or a key with an Enabled of false. It also refuses a key without the SSEType KMS. A BillingMode outside its set is still answered alone before the read (#1109). So a request with that fault and a key that is too long gets the BillingMode fault alone, where DynamoDB lists both. Fixes #1052.
DynamoDB reads an Enabled of "false" as false and any other string as true (measured on UpdateTable, 25 Nov 2026, us-east-1). With "Enabled": "true" or "yes" and SSEType AES256, it answers "SSEType AES256 is not supported". With "Enabled": "false" and SSEType KMS, it answers "SSEType can not be specified if Enabled is false". check_sse_specification read only a JSON boolean, so it passed these requests. Now it reads a string in the same way. CreateTable runs the check, but CreateTable was not measured with these shapes. UpdateTable runs it from #1126 on, and #1126 adds the measured rows.
navareamol
left a comment
There was a problem hiding this comment.
Enabled as a string (create_table.rs, sse_enabled). The check reads any string other than "false" as true, but the stored table is described by SseDescription::from_specification and the backend create_table code, which read Enabled with as_bool(), so a string there is false. On SQLite at ff39b49, CreateTable with {"Enabled": "true", "SSEType": "KMS"} returns 200 and DescribeTable has no SSEDescription, while {"Enabled": "TRUE", "SSEType": "AES256"} is refused as enabled. So one request is treated as encrypted by the check and as unencrypted by DescribeTable. Has anyone checked whether DynamoDB creates a KMS-encrypted table for "Enabled": "true"? If it does, I think the simplest fix is to turn Enabled into a boolean once, before the typed read, so the check and the backends see the same value. Also, no row in nested_enums_tests.rs or test_table_enum_members.py sends Enabled as a string, so deleting the Value::String arm of sse_enabled leaves every test passing. Could you add rows for "false" and for another string?
Table class over a wrong JSON type. .map_err(|e| table_class.clone().unwrap_or(e))? returns before the typed read. CreateTable with BillingMode: "BOGUS", TableClass: "BOGUS" and Tags: "x" gets the table class sentence, while your row ct-table-class-tags (the same without BillingMode) gets SerializationException. UpdateTable with AttributeDefinitions: "x" behaves the same way. Do you know what DynamoDB answers when all three are present? If it is the SerializationException, the table class branch could let the typed read run before it answers.
UpdateTable name checks. CreateTable calls validate_table_name before it returns the table class fault, but UpdateTable returns it before the TableName must not be empty check. UpdateTable with TableName: "" and TableClass: "BOGUS" used to get TableName must not be empty and now gets the table class sentence; a 256-character name gets the table class sentence where the description says DynamoDB answers the name length fault. I think calling the same validate_table_name on UpdateTable before return Err(fault) would answer the length fault. Is there a reason to leave it out?
SSESpecification with no Enabled. check_sse_specification returns Ok when Enabled is missing, so {"SSEType": "KMS"}, {"SSEType": "AES256"} and {"KMSMasterKeyId": "alias/no-such-key"} each create a table with no SSEDescription. Was any of the measured requests sent without Enabled? If DynamoDB refuses these, they need a row and a branch here.
This branch is stacked on #1110 (branch fix/1051-projection-stream-enums), which has a merge conflict with main in crates/engine/src/partiql/test_context.rs. The checks on this PR ran against that branch, so they say nothing about main. Could you update the stack on main?
I will approve once the Enabled string is read the same way by the check and by DescribeTable (or DynamoDB is shown not to encrypt that table) and has test rows, and the UpdateTable name check is either added or explained.
…B does
DynamoDB reads an Enabled written as a string as a boolean while it reads
the body. It reads "true", "t", "yes", "y" and "1" as true, and "false",
"f", "no", "n" and "0" as false, in any ASCII case. It refuses any other
string with SerializationException "Unexpected token received from
parser". It answered so to UpdateTable on 2 Dec 2026, each body twice.
The CreateTable checks read any string other than "false" as true, and
DescribeTable and the backends read a string as false. So the checks read
{"Enabled": "true", "SSEType": "KMS"} as encryption on, and the backends
stored the table without encryption.
CreateTable now writes the boolean back into the specification after the
read, so the checks and the backends read the same value. The new
boolean_text reads the strings from BOOLEAN_TEXTS in query_key_values.rs.
The rows send the strings measured on UpdateTable to CreateTable. A new
test creates tables with "TRUE" and "no" on SQLite and reads DescribeTable.
The SQLite catalog context of the SearchVectors tests moves to
test_context.rs so that both tests use it.
…fault DynamoDB checks the table name of an UpdateTable before it answers a TableClass outside its set, as it does on CreateTable. On 2 Dec 2026 it answered three names beside TableClass "BOGUS" with the name's own fault. The names had 256 characters, 2 characters and a space. UpdateTable now calls validate_table_name there, as CreateTable does. An empty name gets the text CreateTable gives it, where DynamoDB lists the length clause and the pattern clause (#1486).
The test dropped the CreateTable answer, and the compiler warned about the unused result. It now checks the SSEDescription of the CreateTable answer and of DescribeTable. cargo fmt also wraps the UpdateTable name row.
…ynamoDB does
UpdateTable counted a null Enabled as present, so the rule that reads a
specification naming SSEType or KMSMasterKeyId as Enabled true did not
apply. It also took an Enabled of another JSON type and stored it, and the
backends then read it as false. On a KMS table, {"Enabled": null, "SSEType":
"KMS"} and {"Enabled": 1} each turned encryption off.
DynamoDB answered these on 2 Dec 2026, each body twice, on a table that
does not exist:
- {"Enabled": null, "SSEType": "AES256"} gets "SSEType AES256 is not
supported", so a null Enabled counts as absent.
- An Enabled of 1 or 0 gets SerializationException "NUMBER_VALUE cannot be
converted to Boolean".
- An Enabled of [true] gets SerializationException with no message, and
one of {} gets "Start of structure or map found where not expected".
UpdateTable now counts a null Enabled as absent before that rule, and
check_sse_member_types refuses an Enabled of another type with these
texts through check_member_types. It reads an Enabled string with
read_sse_enabled before that check.
The rows hold each measured body, and the strings that #1114 reads now
also go to UpdateTable. A new test checks the SerializationException texts.
|
These are the strings of Table class over a wrong JSON type: DynamoDB answers UpdateTable name checks: fixed in 960293f. UpdateTable now calls
The stack on main: the branches merge instead of rebasing. #1110 merges main in 0a3e466. This PR merges the new head of #1110 in bc443f5 and 1199929, and #1126 merges this PR in 98f7818 and 8bffb25. |
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 #1110. It gives the SSESpecification values that CreateTable now refuses and the TableClass refusal of CreateTable and UpdateTable, with the texts of DynamoDB. It also gives the read of an Enabled string.
The base merges main at c8e66fb, which brings #481, #1137, #1403, #1465, #1515 and #1411, and adds the v1.2.0 entries of #1110 and #1114 to docs/manuals/07-upgrade-manual.md. The merge has no conflict. Git merged two files at other lines. In crates/core/src/types/table.rs, main changes the members of a DELETING table in TableDescription, and this branch changes the doc comment of the SSESpecification member of UpdateTableInput. In crates/storage-mongodb/src/table_engine.rs, main makes the creation time of a table description optional, and this branch records the specification in update_table.
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 #1114. It gives the 1.1.0 answers to an SSESpecification in UpdateTable, the record of an accepted specification, and the refusals with the texts of DynamoDB. It also says what DescribeTable reports after a rollback.
The base now holds main at c057660. #1446 added its v1.2.0 entry at the top of Behavior Changes by Release, and the base moved its own entry after main's v1.2.0 entries. The upgrade manual conflicted where this branch had its entry. The merge takes the manual of the base and puts the entry of this branch after the entry of the base.
|
CreateTable still creates a table without encryption when The string rows for CreateTable are in The upgrade manual says The rest is resolved at 7feeec2. The string Your point on the table class over a wrong JSON type is right: the typed read cannot run first while it refuses I will approve once CreateTable refuses or reads a non boolean |
…backend
The CreateTable rows with an Enabled string ran only in
nested_enums_tests.rs, on SQLite. tests/test_table_enum_members.py now
creates a table from {"Enabled": "TRUE", "SSEType": "KMS"} and one from
{"Enabled": "no"}. It checks the SSEDescription of the CreateTable answer
and of DescribeTable, on the backend of each wire job.
The test does not run against DynamoDB, because no CreateTable with these
bodies went to it.
The entry said that DynamoDB read each Enabled string of its list on 2026-12-02. The requests of that day held "TRUE", "true", "t", "1", "FALSE", "False", "false", "no", "f", "0" and "N", and the refused "", "on" and "maybe". The entry now gives those strings with their date, and "yes", "y" and "n" with 2026-12-03. The other ASCII cases come from other boolean members that DynamoDB reads the same way.
|
CreateTable with an DynamoDB's CreateTable answers to these bodies are not measured: a body that DynamoDB accepts creates a table, and we send no CreateTable to it. On UpdateTable, DynamoDB reads a null String rows on the wire file: added in 0838a5e. The manual entry: reworded in 7b0f3db. It now lists the strings that DynamoDB's UpdateTable read on 2 December 2026. Today I sent The same run checked the 2 December reading of the true strings. The |
navareamol
left a comment
There was a problem hiding this comment.
CreateTable with an Enabled that is a number, a list, an object or a null still creates a table without encryption at 7b0f3db, as before this PR. I agree with the issue: #1547 lists the number, the list and the object with your UpdateTable measurements, and your comment there adds the null. I also read that a null Enabled with SSEType KMS is the body of #1122 if CreateTable reads a null as absent, so the fix of #1547 needs the reading of #1122 too. CreateTable with these bodies is not measured on DynamoDB, and the issue and the comment say so. The code I looked at is unchanged since 7feeec2 (no file in crates/core or crates/engine differs), so it is not a condition for this PR.
The string rows are on the wire file. test_sse_enabled_string_creates_the_table creates a table from {"Enabled": "TRUE", "SSEType": "KMS"} and checks ENABLED and KMS in the CreateTable answer and in DescribeTable, and creates one from {"Enabled": "no"} and checks that it has no SSEDescription. It is skipped against the real service. On SQLite built from the head of #1126, which contains 7b0f3db, test_table_enum_members.py and test_config_fields.py passed 123 tests. With read_sse_enabled changed to write back the opposite boolean, both rows fail. I did not run PostgreSQL, Cassandra or MongoDB myself, the CI legs for them are green.
The manual entry now matches your measurements. The 2 December strings, the 3 December strings ("yes", "y", "n") and the other cases taken from ConsistentRead and similar members are separate, and the entry says CreateTable was not sent an Enabled string. The ten strings in BOOLEAN_TEXTS agree with it.
The TableClass bodies are on #1109: the UpdateTable and CreateTable rows with BillingMode BOGUS, TableClass BOGUS and a member of the wrong JSON type, with the Unexpected field type answer and the date of each run. The head of this PR answers the table class sentence for both, and #1109's change covers them.
Changes since the last review
test_sse_enabled_string_creates_the_tabletotests/test_table_enum_members.py. It creates a table from{"Enabled": "TRUE", "SSEType": "KMS"}and checksSSEDescriptionENABLEDwithSSETypeKMS. It creates another from{"Enabled": "no"}and checks that it has noSSEDescription. Each row checks the CreateTable answer and DescribeTable, so the wire jobs check the boolean that each backend records. The test does not run against DynamoDB, because no CreateTable with these bodies went to it.Enabledstrings in the upgrade manual entry. It names the strings that DynamoDB's UpdateTable read on 2 December 2026, and"yes","y"and"n", which it read on 3 December 2026. The other ASCII cases come from other boolean members that DynamoDB reads the same way.What
CreateTable now refuses the
SSESpecificationvalues that DynamoDB refuses. CreateTable and UpdateTable now refuse aTableClassoutside its set. Each refusal is aValidationExceptionwith DynamoDB's text:SSETypeoutside[AES256, KMS]and aKMSMasterKeyIdof more than 2048 characters go into oneN validation errors detectedmessage with the other member faults. ExtendDB counts the key in characters.{"Enabled": true, "SSEType": "AES256"}getsOne or more parameter values were invalid: SSEType AES256 is not supported.SSETypewithEnabledfalse getsOne or more parameter values were invalid: SSEType can not be specified if Enabled is false. AKMSMasterKeyIdwithEnabledfalse gets the same sentence withKMSMasterKeyIdin place ofSSEType.KMSMasterKeyIdwithEnabledtrue and noSSETypeKMSgetsOne or more parameter values were invalid: SSEType KMS is required if KMSMasterKeyId is specified.TableClassoutside[STANDARD, STANDARD_INFREQUENT_ACCESS]getsInvalid table-class parameter provided. Please try again with a valid table-class value: [STANDARD, STANDARD_INFREQUENT_ACCESS].DynamoDB's UpdateTable reads an
Enabledwritten as a string as a boolean. On 2 December 2026 it read"TRUE","true","t"and"1"as true, and"FALSE","False","false","no","f","0"and"N"as false. It refused"","on"and"maybe"while it read the body, withSerializationExceptionUnexpected token received from parser. On 3 December 2026 it read"yes"and"y"as true and"n"as false. In other boolean members, DynamoDB reads the same ten strings in any ASCII case:"true","t","yes","y"and"1"as true, and"false","f","no","n"and"0"as false.read_sse_enabledincrates/engine/src/create_table.rsreads the string so after the read, and writes the boolean back into the specification. Socheck_sse_specification, the backends and DescribeTable read the same value.boolean_textincrates/engine/src/query_key_values.rsreads the strings fromBOOLEAN_TEXTS, the list of #984. CreateTable was not measured with anEnabledstring. UpdateTable reads the specification from #1126 on, and #1126 adds the measured UpdateTable rows. TheOne or more parameter values were invalidsentences apply whenEnabledis a boolean or such a string. AnEnabledof another JSON type is not checked on CreateTable (#1547).The checks run in DynamoDB's order, except for the requests listed at the end. A member of the wrong JSON type answers first, and so does an
Enabledstring that DynamoDB does not read as a boolean. The table name checks come next, on CreateTable and on UpdateTable. The table class fault then answers ahead of the member faults thatEnumFaultsrecords, and on UpdateTable ahead of the table lookup. Two faults still answer ahead of the table class fault, where DynamoDB answers the table class fault first. The first is a null or missingStreamEnabled, which ExtendDB checks before it reads the request. The second is aKeyTypeoutside its set, which the typed read refuses. ExtendDB checksBillingModeandTableThroughputModebefore it reads the request, so the table class fault answers in place of those faults.On CreateTable, the member faults list the GSIs, then the key length, then
SSEType, thenStreamViewType, then the LSIs. TheSSESpecificationsentences come after the member faults and the other checks of the request, and ahead of theResourceInUseExceptionfor a table that exists.table_class_faultandEnumFaults::sse_specificationare incrates/engine/src/nested_enums.rs.check_sse_specificationis incrates/engine/src/create_table.rs.The
KMSMasterKeyIdwithEnabledfalse sentence is not in the issue's table. DynamoDB refuses that request with it (measured 18 November 2026), and the head of #1110 creates the table. It is one line in the check that writes the issue'sSSEType can not be specified if Enabled is false.This PR targets the branch of #1110,
fix/1051-projection-stream-enums, because it adds the SSE members to theEnumFaultsrecord that #1110 adds. Merge #1110 first.The message of ff39b49 says that DynamoDB reads the string
"false"as false and any other string as true. 45cc084 replaces that reading with the one measured on 2 December 2026. The message of 773a50a says "ExtendDB now checks in this order, except for UpdateTable's name length (#1109)". A null or missingStreamEnabledand aKeyTypefault also answer ahead of the table class fault, as this section says. Whoever merges: please use the What section of this body as the squash message.Why
These are DynamoDB's answers, measured in us-east-1. DynamoDB answered the rows of the issue on 13 and 14 November 2026. On 18 November 2026, 42 more requests that DynamoDB refuses went out twice each, to DynamoDB and to ExtendDB on SQLite. Each request got the same answer both times. 773a50a gives DynamoDB's error type and text to 28 of them, and the head of #1110 to 3. Each of those 3 keeps its answer. Both builds accept 4 more requests that DynamoDB accepts. None of the 42 requests sends
Enabledas a string or carriesReplicaUpdates. 960293f changes the answers of two of them, which the list below names. The 42 requests were not sent again to this head.Closes #1052
Testing done
cargo +1.97.0 test --libpassed 983 engine tests and 1260 core tests, with 1 ignored. The server lib tests gave 521 passed and 5 failed. The 5 are thebackup_store::teststhat refuse a spool or a backup root under/local/home, which belongs to another user on the build host (storage-sqlite: the two write_lock_tests fail when an ancestor of the Cargo target directory is owned by another user #1414).cargo +1.97.0 test -p extenddb-wasm-adapterpassed its 3 unit tests and theparitycorpus test, andcargo +1.97.0 test -p extenddb-storage-postgres --test doc_version_literalspassed 3 tests.cargo +1.97.0 fmt --all -- --checkis clean. The two clippy commands of CI on the workspace with-D warningsare clean: one with--features extenddb-storage-cassandra/test-hooks,extenddb-storage-mongodb/test-hooks, and one with--features extenddb-engine/backup-test-hooks. So arecargo +1.94.0 check --all-targetson the engine and the clippy step of the WebAssembly workflow.tests/test_table_enum_members.pysends the issue's rows, rows for the measured order and the UpdateTable name rows, and creates the two tables from anEnabledstring. Against ExtendDB on SQLite and on PostgreSQL, built from 7b0f3db, this file passed 62 tests. The two Python suites collect with no error: 7366 tests intests/and 820 intests/python.Enabledreading of ff39b49, the row test fails on the"FALSE"row, and the new test fails on the table created with"TRUE": DescribeTable has noSSEDescription. Without the name check on UpdateTable, the row test fails on the name of 256 characters.read_sse_enabledchanged to write back the opposite boolean, both rows oftest_sse_enabled_string_creates_the_tablefail."TRUE"getsSSEType can not be specified if Enabled is false, and the"no"table reportsENABLED.Line counts: production +131 -9, tests +381 -40. The round of 2 December: production +37 -11, tests +148 -47. The round of 3 December: tests +28 -1, and one paragraph of the upgrade manual. The upgrade manual entry has 14 lines. The test counts include the SQLite catalog context, which moves from
search_vectors_order_tests.rstotest_context.rs.Not in this PR, each in an open issue:
billingModefault alone, before the read:"BillingMode": "BOGUS"with a key of 2049 characters. DynamoDB lists both faults (CreateTable and UpdateTable check their members in another order than DynamoDB, and name fewer faults in one message #1109). A comment on CreateTable and UpdateTable check their members in another order than DynamoDB, and name fewer faults in one message #1109 carries this row.BillingModeBOGUS,TableClassBOGUSand a member of the wrong JSON type, DynamoDB answersSerializationException, and this PR the table class text. ExtendDB checksBillingModebefore the read, as on main, where the answer is thebillingModefault (CreateTable and UpdateTable check their members in another order than DynamoDB, and name fewer faults in one message #1109). A comment on CreateTable and UpdateTable check their members in another order than DynamoDB, and name fewer faults in one message #1109 lists the two requests of this kind, one for CreateTable and one for UpdateTable.TableNameof 256 characters, or with a space and!, beside aTableClassofBOGUS. The open issues for the others are:SSESpecificationsentences among the attribute definition and throughput checksKMSMasterKeyIdthat is a numberTableNamethat is empty, which DeleteTable and UpdateTable answer an empty TableName with texts of their own, where DynamoDB lists the length clause and the pattern clause #1486 also tracks, or 256 characters long, which this PR now answers as DynamoDB doesStreamEnabledor aKeyTypefault answers ahead of the table class fault. Three of them are among the 14.SSESpecificationon UpdateTable.Enabled. DynamoDB refuses anEnabledthat is a number, a list or an object on UpdateTable, and fix(engine): read SSESpecification in UpdateTable #1126 refuses them there too. CreateTable was not measured with them (CreateTable accepts an SSESpecification Enabled that is a number, a list or an object, where DynamoDB refuses it on UpdateTable with SerializationException #1547). A nullEnabledbesideSSETypeKMSalso creates a table without encryption here. DynamoDB's UpdateTable reads a nullEnabledas absent, so that fix also needs the reading of CreateTable reads an SSESpecification of {"SSEType": "KMS"} without Enabled as no encryption, where DynamoDB enables KMS #1122. A comment on CreateTable accepts an SSESpecification Enabled that is a number, a list or an object, where DynamoDB refuses it on UpdateTable with SerializationException #1547 adds that row.Other open PRs:
crates/engine/src/create_table.rs, and this PR adds a second hunk there. fix(tagging): validate tag keys and values against the service grammar #485 reads the CreateTable body earlier, ahead of the table name and tag checks. The resolution captures the table class fault before that read and answers it after the read and the name check.crates/engine/src/update_table.rs. The resolution keeps the table class fault of this PR beside the missingTableNamecheck and the read of fix(engine): answer a missing TableName, Key or Item as DynamoDB does #1262.reads_as_booleanbesideBOOLEAN_TEXTSincrates/engine/src/query_key_values.rs. It gives the same test asboolean_text(text).is_some(). The two PRs change other lines of that file and merge in either order, and the PR that merges second drops its copy.docs/manuals/07-upgrade-manual.md. A dry merge (git merge-tree) with each of the 53 open PRs that change that file gives a conflict there for 29 of them. The head of fix(engine): refuse ProjectionType and StreamViewType outside their sets #1110 gives a conflict there with the same 29 PRs, and main with the same 29 and fix: send LastIncreaseDateTime after an UpdateTable raises throughput #1207. So this PR adds none of them. Whichever PR merges second keeps both entries.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
CreateTable refuses the
SSESpecificationrequests above that the previous release accepted, and creates no table for them. A client that sends one getsValidationExceptionwhere it got a new table. CreateTable and UpdateTable refuse aTableClassoutside[STANDARD, STANDARD_INFREQUENT_ACCESS]. The previous release created or updated the table with that value, or answered another fault. A table that the previous release created with such a value keeps it after the upgrade. CreateTable now reads anEnabledstring as DynamoDB reads it. With{"Enabled": "true", "SSEType": "KMS"}it creates a table with encryption, where the previous release created one without, and a string such as"on"getsSerializationException. 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.