Repository navigation
fix(engine): read SSESpecification in UpdateTable - #1126
LeeroyHannigan wants to merge 15 commits into
Conversation
UpdateTable did not count SSESpecification as a change. A request with TableName and SSESpecification alone was refused as one that names no change. DynamoDB reads the specification. It refuses an SSEType outside its set, an SSEType of AES256, an SSEType with Enabled false and a KMSMasterKeyId without the SSEType KMS. It accepts a specification that enables or disables KMS, and changes the table's encryption. The answers were measured in us-east-1 on 13, 14 and 18 Nov 2026. UpdateTable now counts the member as a change. It lists a KMSMasterKeyId of more than 2048 characters and an SSEType outside its set first among the member faults, as DynamoDB does. It refuses a specification whose members do not go together with the sentences CreateTable uses. After them it refuses a specification beside another change, such as BillingMode or a new index, with DynamoDB's sentence. DynamoDB answers a BillingMode of PROVISIONED without ProvisionedThroughput first, so these checks follow the BillingMode checks. They run before the table lookup, as DynamoDB answers them for a table that does not exist. A stream change beside ProvisionedThroughput keeps its own sentence, which DynamoDB answers ahead of the specification one. Each backend records an accepted specification as CreateTable records it, so DescribeTable reports the new SSEDescription. DynamoDB reads a specification without Enabled that names SSEType or KMSMasterKeyId as one with Enabled true. UpdateTable adds Enabled true to it before the checks above. DynamoDB refuses an Enabled of false, or an empty specification, on a table that uses the default encryption. UpdateTable now refuses both with DynamoDB's sentence, after the table lookup, as DynamoDB does. DynamoDB reports the change as UPDATING for about 45 seconds, where ExtendDB reports the new settings at once. Fixes #1054.
UpdateTable did not check the JSON type of SSESpecification or of its SSEType and KMSMasterKeyId. Such a specification reached the table lookup and the backend write. On a table with KMS the backend recorded it, and DescribeTable then reported another SSEDescription or none. DynamoDB refuses these requests while it reads the body (measured 25 Nov 2026, us-east-1). It answers "x" with SerializationException "Unexpected field type", and an SSEType of 5 with "NUMBER_VALUE cannot be converted to String". UpdateTable now gives these answers after the read. The member texts come from check_member_types, which GetShardIterator's check_member_shapes now calls. UpdateTable also writes an Enabled given as a string as a boolean, in the way check_sse_specification reads it. "false" is false and any other string is true. The backends read only a boolean Enabled, so the record and the check now agree. A null SSEType or KMSMasterKeyId no longer counts as present when UpdateTable adds "Enabled": true.
…ation
No UpdateTable row had an SSE fault beside a stream view type fault or
an index fault. So no test saw that the SSE faults come first. Add the
two rows measured on 25 Nov 2026. In one the SSEType and the
StreamViewType are both BOGUS. In the other a GSI Create has the
ProjectionType BOGUS, and the body sends it ahead of the SSEType BOGUS.
DynamoDB lists the SSEType fault first in both.
Add the empty specification on a table with the default encryption,
measured on 18 Nov 2026. It gets "Table is already encrypted by
default", as {"Enabled": false} does.
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.
I think an Enabled that is not a boolean or a string turns encryption off on a KMS table. The code adds "Enabled": true only when spec.get("Enabled").is_none(), so a null Enabled counts as present while a null SSEType counts as absent. check_sse_member_types checks SSEType and KMSMasterKeyId but not Enabled. On SQLite at e1b4a52, on a table created with {"Enabled": true, "SSEType": "KMS"}, each of {"Enabled": null, "SSEType": "KMS"}, {"Enabled": null}, {"Enabled": 1, "SSEType": "KMS"}, {"Enabled": 1} and {"Enabled": [true], "SSEType": "KMS"} answers 200, and DescribeTable then has no SSEDescription. On a table with the default encryption, {"Enabled": 1, "SSEType": "AES256"} answers "Table is already encrypted by default" instead of the AES256 sentence. Has anyone sent these shapes to DynamoDB? If it reads a null Enabled as absent, as the PR reads a null SSEType, {"Enabled": null, "SSEType": "KMS"} is an enable there. One option: treat a null Enabled as absent before the implied rule, and refuse a number, list or object Enabled with the text DynamoDB gives, with a row for each.
{} is measured only on a table with the default encryption (default-empty), and test_update_table_records_sse[disabled] sends {"Enabled": False}. On a KMS table, {}, {"SSEType": null}, {"KMSMasterKeyId": null} and {"Foo": "x"} each turn encryption off here. Could you measure {} on a KMS table on DynamoDB and add it to the test_update_table_records_sse rows?
I will approve once the Enabled shapes above are measured on DynamoDB and the code and rows follow that answer.
…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.
DynamoDB accepted UpdateTable with {"SSESpecification": {}} on a table
created with KMS on 18 Nov 2026. It reported UPDATING, and 45 seconds later
DescribeTable had no SSEDescription. The row kms-empty of
test_update_table_records_sse holds that answer.
cargo fmt wraps the line that reads Enabled as a boolean in UpdateTable.
|
The
UpdateTable now counts a null
|
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). The upgrade manual conflicted where this branch had its v1.2.0 entry. The merge takes the manual of the base and puts the entry of this branch after the entry of the base. Git merged crates/storage-mongodb/src/table_engine.rs, where #1446 changes DeleteTable and this branch changes UpdateTable, at other lines.
|
The upgrade manual does not say that Two wording points in the manual. It says a specification beside another change gets the "must be the only operation" sentence, but a stream change beside CreateTable still creates a table without encryption for a null, number, list or object The two points from my review are resolved at ee68ac8, which contains #1114 at 7feeec2 and main. A null I will approve once the manual says what |
test_update_table_records_sse gets the row kms-enabled-null: UpdateTable
with {"Enabled": null} on a table with KMS. ExtendDB reads the null as
absent, as for {}, so DescribeTable then reports no SSEDescription.
The row asserts the answer of ExtendDB. It does not run against DynamoDB,
whose answer needs a table with KMS: we did not create one to measure it.
The update goes through the client without parameter validation, because
the SDK refuses a null Enabled before it sends the request.
The UpdateTable entry now says that {"Enabled": false}, {} and
{"Enabled": null} on a table with KMS remove its SSEDescription. It gives
the measurement of the first two and says that the third has none. It
names the stream sentence that a StreamSpecification beside
ProvisionedThroughput gets ahead of the specification sentence.
The entry said that ExtendDB records a KMSMasterKeyId. It now says that
DescribeTable does not report the key: the KMSMasterKeyArn ends in
key/default for every key.
|
The row is The manual sentence: added in 34c630e, next to the "already encrypted by default" line. On a table with The two wording points, both in 34c630e:
CreateTable: see my answer on #1114. #1547 tracks the number, the list and the object, and a comment on #1547 adds the null. |
navareamol
left a comment
There was a problem hiding this comment.
{"Enabled": null} alone on a KMS table: your answer settles my question. Nobody sent it to DynamoDB, because it needs a KMS table that exists, and the UpdateTable bodies on a missing table only show that both {"Enabled": null} and {} pass the checks before the table lookup. The row kms-enabled-null pins ExtendDB's answer and says in its comment that it is not a service measurement. On SQLite built from 34c630e, test_config_fields.py and test_table_enum_members.py passed 123 tests. With a null Enabled read as true in update_table.rs, kms-enabled-null fails while kms-empty and kms-without-enabled pass, so the row detects that change.
The manual sentence says what a reader needs: on a KMS table, UpdateTable accepts {"Enabled": false}, {} and {"Enabled": null}, DescribeTable then reports no SSEDescription, the first two match your 18 November measurement, and the answer to a null alone is not measured.
Both wording points are fixed. The "only operation" bullet names the StreamSpecification beside ProvisionedThroughput exception, which agrees with the guard in update_table.rs. The entry says DescribeTable does not report the key and shows key/default for every key, as I measured with alias/orig and alias/y.
CreateTable with a null, number, list or object Enabled: #1547 and its comment cover it, so the difference between the two operations is tracked and I do not hold this PR for it.
One optional line: the docstring of test_update_table_records_sse still says "Measured on 18 Nov 2026: DynamoDB accepts each request". The new null row is not measured, so a short "except kms-enabled-null" there would match the comment above the row.
Changes since the last review
kms-enabled-nullnext tokms-emptyintest_update_table_records_sse:{"Enabled": null}alone on a table with KMS. The row asserts the answer of ExtendDB, which reads the null as absent, as for{}. DescribeTable then reports noSSEDescription. The row does not run against DynamoDB, because the answer of DynamoDB needs a table with KMS that exists, and it is not measured. The update now goes throughdynamodb_client_no_validation, because the SDK refuses a nullEnabledbefore it sends the request.{"Enabled": false},{}and{"Enabled": null}on a table with KMS, and that DescribeTable then reports noSSEDescription. It also says that DynamoDB answered the first two that way, and that its answer to the third is not measured.StreamSpecificationbesideProvisionedThroughputgets the stream sentence first.KMSMasterKeyArnends inkey/defaultfor everyKMSMasterKeyId.tests/test_table_enum_members.pyconflicted. The merge keeps the CreateTable sentence of fix(engine): refuse the TableClass and SSESpecification DynamoDB refuses #1114 in the CreateTable item, and the UpdateTable item of this PR after it.crates/storage-mongodb/src/table_engine.rsat other lines: fix(storage-mongodb): keep a DELETING table's tags until its document goes #1446 changes DeleteTable there, and this branch changes UpdateTable. At b48d586 the MongoDB crate passes the clippy command of CI and its lib tests (197 passed, 86 ignored).What
UpdateTable now reads
SSESpecification. It did not count the member as a change, so a request that carried it alone gotAt least one of BillingMode, ProvisionedThroughput, DeletionProtectionEnabled, StreamSpecification, GlobalSecondaryIndexUpdates, or WarmThroughput must be specified. Each refusal below is aValidationExceptionwith DynamoDB's text:KMSMasterKeyIdof more than 2048 characters and anSSETypeoutside[AES256, KMS]come first among UpdateTable's member faults, ahead of the index and stream view type faults.One or more parameter values were invalidsentences of CreateTable (fix(engine): refuse the TableClass and SSESpecification DynamoDB refuses #1114) refuseSSETypeAES256, anSSETypeor aKMSMasterKeyIdwithEnabledfalse, and aKMSMasterKeyIdwithoutSSETypeKMS.One or more parameter values were invalid: Server-Side Encryption modification must be the only operation in the request. The other changes areBillingMode,ProvisionedThroughput,DeletionProtectionEnabled,StreamSpecification,TableClass,OnDemandThroughputandGlobalSecondaryIndexUpdates. A stream change besideProvisionedThroughputkeeps its own sentence, which DynamoDB answers first.{"Enabled": false}and{}on a table with the default encryption getOne or more parameter values were invalid: Table is already encrypted by default.The member faults come first. The four sentences and the "only operation" sentence follow the
BillingModeand throughput checks. All of them come before the table lookup, and the "already encrypted" sentence comes after it. DynamoDB answers them in this order.DynamoDB refuses a specification of the wrong JSON type while it reads the body, with
SerializationException. A specification that is not a JSON object getsUnexpected field type(measured for a string). AnEnabledthat is not a boolean or a string gets the texts above. AnSSETypeorKMSMasterKeyIdthat is not a string gets the type text thatcheck_member_typesgives, for exampleNUMBER_VALUE cannot be converted to Stringfor a number. UpdateTable answers these after the read, ahead of the table class and member faults. #1262 adds a reader,json_object, that refuses a specification that is not a JSON object on both inputs. The PR that merges second keeps one of the two checks.DynamoDB reads a specification without
Enabledthat namesSSETypeorKMSMasterKeyIdas one withEnabledtrue, so UpdateTable adds"Enabled": trueto it before the checks. A nullEnabled,SSETypeorKMSMasterKeyIdcounts as absent (measured on a table that does not exist on 2 December 2026).{}stays a request to disable, and so does{"Enabled": null}. On a table with KMS, UpdateTable accepts both, and DescribeTable then reports noSSEDescription. DynamoDB answered{}that way on 18 November 2026. Its answer to{"Enabled": null}alone needs a table with KMS that exists, and it is not measured. AnEnabledwritten as a string becomes the boolean that DynamoDB reads, as on CreateTable (#1114). In any ASCII case,"true","t","yes","y"and"1"are true, and"false","f","no","n"and"0"are false. Another string getsSerializationExceptionUnexpected token received from parser. AnEnabledof another JSON type getsSerializationExceptionwith DynamoDB's text:NUMBER_VALUE cannot be converted to Booleanfor a number, no message for a list, andStart of structure or map found where not expectedfor an object. So each backend records the value that the check read.Each backend records an accepted specification beside its
TableClasswrite, in the same transaction or write, as its CreateTable records it. DescribeTable then reports the newSSEDescription. The backends are SQLite, PostgreSQL, MongoDB and Cassandra.UpdateTable accepts and records a
KMSMasterKeyIdwithSSETypeKMS, as ExtendDB's CreateTable does, because ExtendDB makes no KMS request. DescribeTable does not report the key: theKMSMasterKeyArnends inkey/defaultfor every key. DynamoDB answers a key that does not exist with the fault of its KMS lookup (rows 7 and 8 of the issue).This PR targets the branch of #1114,
fix/1052-sse-table-class, because it callscheck_sse_specificationandEnumFaults::sse_specificationfrom #1114. Merge #1110 and #1114 first.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, UpdateTable requests of each shape above went out to DynamoDB and to ExtendDB on SQLite. They went to a table that does not exist, to tables with the default encryption, and to tables with KMS. On 25 November 2026, more requests went to a table that does not exist. They carry a specification of the wrong JSON type, an
Enabledstring, or an SSE fault beside another member fault. On 2 December 2026, more requests went to a table that does not exist. They carry anEnabledstring, a nullEnabled, anEnabledof another JSON type, or a nullSSETypeorKMSMasterKeyId. On 3 December 2026,{"Enabled": null}and{}went to a table that does not exist and gotResourceNotFoundException. Each refused request went out twice and got the same answer both times. The request{}on a table with KMS went out once on 18 November 2026, because it changes the table. DynamoDB reportedUPDATING, and noSSEDescription45 seconds later.Closes #1054
Testing done
cargo +1.97.0 test --libpassed 984 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 test -p extenddb-storage-sqlite --no-fail-fastpassed 336 tests, with 1 ignored. Four tests failed on the build host: the twobackup_catalog::write_lock_tests, and one test each intests/backup_job_panic.rsandtests/restore_job_resume.rs. Each refuses its backup root because/local/home, an ancestor of the target directory, belongs to another user (storage-sqlite: the two write_lock_tests fail when an ancestor of the Cargo target directory is owned by another user #1414).cargo test --libpassed on the PostgreSQL, MongoDB and Cassandra backends. PostgreSQL passed 84 tests, MongoDB 190 with 83 ignored (they need a MongoDB server), and Cassandra 175. This round changes no backend file, but the merges add main's changes, and these tests were not run again. CI runs them.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.cargo +1.94.0 check --all-targetson the core, the engine and the four storage crates is clean, and so is the clippy step of the WebAssembly workflow.tests/test_table_enum_members.pyandtests/test_config_fields.pypassed 123 tests. The new rows check each refusal, and that the table keeps its encryption after it. They also check the encryption DescribeTable reports after an accepted change,{}and{"Enabled": null}on a table with KMS among them. The two Python suites collect with no error: 7421 tests intests/and 820 intests/python.Enabledadded forSSETypeKMSaloneEnabledEnabledfalse, the wire file failed on the empty specification row alone.Enabledcounted as present, the row test fails on the nullEnabledrow. Without theEnabledtype check, the new testsse_member_type_textsfails.Enabledalone read asEnabledtrue, the rowkms-enabled-nullfails, andkms-emptyand the other rows oftest_update_table_records_ssepass.On the build host, the four backend writes went through the compiler and clippy at 34c630e. The SQLite and PostgreSQL writes also went through the two wire files. The PostgreSQL, MongoDB and Cassandra lib tests ran at 7d87f97, and the MongoDB lib tests again at b48d586. CI runs them, and the wire files on MongoDB and Cassandra.
Line counts: production +161 -27, tests +332 -9. The round of 2 December: production +32 -17 in its own commits and the merge resolution described above, tests +90 -18. The round of 3 December: tests +11 -3 and three lines of the upgrade manual entry in its own commits. Its merge resolves the module doc of
tests/test_table_enum_members.py. The upgrade manual entry has 15 lines.Not in this PR, each in an open issue:
UPDATINGfor about 45 seconds after the change, and names the account's AWS managed key. ExtendDB reports the new settings at once, with the key ARNkey/default(SSEDescription names the KMS key key/default, where DynamoDB names the account's AWS managed key, and shows no UPDATING state #1124).{"SSEType": "KMS"}withoutEnabledas no encryption (CreateTable reads an SSESpecification of {"SSEType": "KMS"} without Enabled as no encryption, where DynamoDB enables KMS #1122).BillingModePROVISIONEDwithoutProvisionedThroughputwith another text (UpdateTable refuses BillingMode PROVISIONED without ProvisionedThroughput with another text than DynamoDB #1123).GlobalSecondaryIndexUpdatesCreateout of the member faults (CreateTable and UpdateTable check their members in another order than DynamoDB, and name fewer faults in one message #1109).ProvisionedThroughputanswersResourceNotFoundException(UpdateTable of a missing table with a stream change beside ProvisionedThroughput answers ResourceNotFoundException, where DynamoDB refuses the pair #1115).ReplicaUpdateslist with aCreate, and beside an emptyGlobalSecondaryIndexUpdateslist. DynamoDB refuses both, each with its own text (UpdateTable accepts an SSESpecification beside ReplicaUpdates or an empty GlobalSecondaryIndexUpdates, where DynamoDB refuses it #1483).Enabledthat is null, a number, a list or an object. UpdateTable now reads the null as absent and refuses the others (CreateTable accepts an SSESpecification Enabled that is a number, a list or an object, where DynamoDB refuses it on UpdateTable with SerializationException #1547).Other open PRs:
crates/engine/src/update_table.rs. Each adds araises_capacityflag to the condition of the block inhandle_update_tablethat reads the table, at the line where this PR addsdisables_sse. The resolution keeps both flags. fix: answer UPDATING while an UpdateTable change applies #1093 and fix: send LastIncreaseDateTime after an UpdateTable raises throughput #1207 also add flags to that condition, and they merge with this PR without a conflict.update_tablepaths without a conflict. Itsenters_updatingdoes not listSSESpecification, so after both merge, a change of the specification keepsTableStatusACTIVE, as on DynamoDB.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 the TableClass and SSESpecification DynamoDB refuses #1114 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
An UpdateTable with an
SSESpecificationnow changes the table's encryption settings, or gets one of the refusals above. The previous release answered such a request with theAt least one of ... must be specifiedtext when the specification came alone. BesideWarmThroughput, it answered the "only operation" sentence. Beside another change, it applied that change and did not act on the specification. The v1.2.0 entry ofdocs/manuals/07-upgrade-manual.mdgives this change and the refusals.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.