Repository navigation
fix(server): refuse a BackupArn or TableName of another JSON type first - #1291
LeeroyHannigan wants to merge 5 commits into
Conversation
ExtendDB read a BackupArn that is neither a string nor null as an absent member on RestoreTableFromBackup, DescribeBackup and DeleteBackup, and answered ValidationException. It did the same with the TableName of DescribeContinuousBackups and of an UpdateContinuousBackups that disables point-in-time recovery. Amazon DynamoDB answers SerializationException to each of them, as it does for a restore TargetTableName of another JSON type. DynamoDB gives that answer before any other check of the request. On a restore it comes before the checks of the target name and of the overrides, and before the answer to a missing target. The server now refuses such a member before authorization, with the text it gives a restore's TargetTableName of another type. A null member is still an absent member. An UpdateContinuousBackups that enables recovery keeps its ContinuousBackupsUnavailableException, because ExtendDB refuses point-in-time recovery before it reads the members. Measured in us-east-1 on 21 Nov 2026. Fixes #1263.
Conflict in table_name_gate.rs, in the unit test of a restore target of another JSON type. On fix/1246-restore-target-type, 6fdc2cb renamed that test and made it check the SerializationException text by equality. This branch replaces the test with a table over BackupArn, TargetTableName and TableName, which checked only the exception type. The merge keeps the table and checks the full text of each row by equality: the text names the member that the gate refuses.
The README lists the checks that the WebAssembly build does not make. The server now refuses a BackupArn, TargetTableName or TableName of another JSON type with SerializationException before any other check of the member. The table gets a member types row with the answers of both builds. On DescribeContinuousBackups and UpdateContinuousBackups the WebAssembly build reads such a TableName as absent. Two parity corpus cases record that answer.
navareamol
left a comment
There was a problem hiding this comment.
I think two things need a change before this merges.
-
CI on 23f962d has not finished. The
integrationgate jobs of the Integration Tests, MongoDB Integration Tests and Cassandra Integration Tests workflows were cancelled before a runner picked them up, so the step that checks the shards ran every test never ran on any backend. Thewasmjob failed on theInstanttype error that main fixed in #1482, so the wasm32 run of the two new corpus cases has not happened yet. The branch is 14 commits behind main at 222d80a, and main has since added a backup integration job that has not run on this code. I merged main locally with no conflict. On the merged tree, fmt, clippy on the server and engine with warnings as errors, cargo check of the whole workspace with all targets, the server lib tests (528) and the wasm adapter tests with the native parity run all pass. Could you update the branch with main and rerun CI? -
Two rows of the table in the description have no test. On this branch,
UpdateContinuousBackupswith{"TableName": 5}and noPointInTimeRecoverySpecificationanswers SerializationException, and with{"TableName": 5, "PointInTimeRecoverySpecification": {"PointInTimeRecoveryEnabled": true}}it answers ContinuousBackupsUnavailableException. I measured both on SQLite. The unit test callscheck_table_name_charsonly with the disable body, and the wire test sends only the disable body too. So ifstring_membermoved behind a check of the specification, or the enable refusal moved behind the gate, every test would still pass. I think both rows belong in the rows list oftest_a_missing_table_name_member_is_the_required_parameter_text.
One question, not a condition. CreateBackup with {"TableName": 5, "BackupName": "b"} answers Value null at 'tableName', and with "BackupName": 5 it answers Value null at 'backupName', on this branch and on main. Has anyone sent these to DynamoDB? If it answers SerializationException, that could be a follow up issue next to #1263.
I will approve once CI is green on a head that includes main and the two UpdateContinuousBackups rows are in the wire test.
The parent branch now contains main at b3510a9. Conflict in README.md: #1521 moved the WebAssembly section of README.md to docs/webassembly.md. This merge keeps main's README.md. It makes the two README edits of this branch in docs/webassembly.md: the order sentence of the member types check, and the two member types rows. The parent branch added a member types row for the TargetTableName alone. The first row of this branch covers that member too, so it takes the place of that row.
The description gives two more UpdateContinuousBackups requests with a TableName of 5, and no test sent them. One has no PointInTimeRecoverySpecification and gets SerializationException. The other enables recovery, and the server refuses it with ContinuousBackupsUnavailableException before it reads the other members. DynamoDB answers both with SerializationException (measured in us-east-1 on 3 Dec 2026). The rows are in the table of test_a_missing_table_name_member_is_the_required_parameter_text.
The question: on 3 December 2026 DynamoDB answered both CreateBackup requests with SerializationException |
navareamol
left a comment
There was a problem hiding this comment.
Both UpdateContinuousBackups rows are in test_a_missing_table_name_member_is_the_required_parameter_text and they pin what I asked for. I checked on a SQLite build of this branch with current main. If the gate only reads TableName when a PointInTimeRecoverySpecification is present, the row with TableName 5 and no specification fails. If the enable refusal runs after the gate, the row with TableName 5 and an enable fails, and so does test_a_missing_table_on_the_continuous_backups_operations. Against a build of #1267 the new rows fail as well.
The CreateBackup answer is clear from your 3 December measurement: SerializationException for a TableName or BackupName that is a number, where this build says the member is null. #1553 is the right place for it.
The README edits are in docs/webassembly.md, the member types rows replace the row #1267 added, and every check on 06402b5 is green, including the integration gates that were cancelled before. On the merged tree with main, clippy with warnings as errors, fmt and the server lib tests pass. Unsigned, wrong secret, unknown key and tampered requests still get the authentication errors before the new answers.
I approve this PR.
Changes since the last review
2f7354271cmerges fix(server): answer a restore's override kinds and account before its name #1284's new head8a0bd882b2, which contains fix(server): refuse a restore's TargetTableName of another JSON type first #1267's new head andmainatb3510a93ee. It has one conflict, inREADME.md: docs(readme): lead with a first request, move WebAssembly to its own page #1521 moved the WebAssembly section of the README todocs/webassembly.md. The merge keeps the README ofmainand makes the README edits of this PR indocs/webassembly.md. There, the member types rows of this PR take the place of the row that fix(server): refuse a restore's TargetTableName of another JSON type first #1267 added forTargetTableName. The first of these rows covers that member too. The other lines this PR changes stay the same.06402b5de0: the table oftest_a_missing_table_name_member_is_the_required_parameter_textintests/test_continuous_backups.pygets the two UpdateContinuousBackups rows of the description.{"TableName": 5}gets SerializationException.{"TableName": 5}with recovery enabled getsContinuousBackupsUnavailableException.TableNameor aBackupNameof5. It also gives the test runs at the new head.What
The server now refuses these members with a SerializationException when the value is neither a string nor null:
BackupArnof RestoreTableFromBackup, DescribeBackup and DeleteBackup.TableNameof DescribeContinuousBackups, and of an UpdateContinuousBackups that disables point-in-time recovery.Before this change, ExtendDB read such a value as an absent member and answered ValidationException. DynamoDB answers SerializationException before any other check of the request.
The new function
string_memberincrates/server/src/table_name_gate.rsdoes the check.check_table_name_charscalls it before authorization. The text is the one that a restore'sTargetTableNameof another type already gets:Start of structure or map found where not expected: <member>. The inline check ofTargetTableNamenow calls the same function. A null member is still an absent member.On a restore, the
BackupArncheck comes after the type check ofTargetTableName. It comes before the checks of the backup ARN, of the target name and of the overrides.An UpdateContinuousBackups that enables recovery keeps its ContinuousBackupsUnavailableException. The server gives that refusal before it reads the other members, for every request shape (
docs/differences-from-dynamodb.md, "Point-in-time recovery").The WebAssembly build makes none of these checks. It refuses DescribeBackup, DeleteBackup and RestoreTableFromBackup, and its engine reads a
TableNameof another JSON type as absent. The table ofdocs/webassembly.mdnow says so, and two parity corpus cases record that answer.The base of this PR is #1284.
Why
These are DynamoDB's answers, measured in us-east-1 on 21 November 2026. Each request went out twice and got the same answer both times. No request names a backup or a table that exists. A restore has the target name
ets-parity1263-targetunless the row gives another name.1 validation error detected: Value null at 'backupArn' failed to satisfy constraint: Member must not be null.The parameter 'TableName' is required but was not present in the request.TableName must be at least 3 characters long and at most 255 characters long.1 validation error detected: Value null at 'pointInTimeRecoverySpecification' failed to satisfy constraint: Member must not be null.BackupArn5,true,{},[],["a"]or5.5BackupArn5, target namea*before or after itBackupArn5, target nameabor no target nameBackupArn5,BillingModeOverridePAYbefore or after itbillingModeOverrideBackupArn5,GlobalSecondaryIndexOverride[{}]BackupArn5,TargetTableName5BackupArnnullInvalid Backup ARNBackupArn5or{}TableName5,true,{},[]or5.5TableNamenullTableName5, recovery disabledTableName5, noPointInTimeRecoverySpecification(also on 3 December 2026)PointInTimeRecoverySpecificationTableName5, recovery enabled (also on 3 December 2026)With this change, ExtendDB gives DynamoDB's exception type to each row but the last. In the SE rows, ExtendDB's text names the member, and DynamoDB's texts are #1012.
Fixes #1263
Testing done
At
06402b5de0, each cargo command with--locked:cargo +1.97.0 test -p extenddb-core -p extenddb-engine -p extenddb-server -p extenddb-storage --lib: core 1259 passed and 1 ignored, engine 982 passed, server 523 passed and 5 failed, storage 294 passed. On this host 5backup_store::testsfail on every branch, because uid 65534 owns/local/home.cargo +1.97.0 fmt --all -- --checkis clean.cargo +1.97.0 clippyof the four crates with--all-targets -- -D warningsis clean, and so is the same command with--features extenddb-engine/backup-test-hooks.cargo +1.94.0 checkof the four crates with--all-targetsis clean.cargo +1.97.0 test -p extenddb-wasm-adapter: the 3 unit tests pass, and the parity test passes over the 281 cases of the corpus, the two cases of this PR among them. The clippy step of the WebAssembly workflow, run on this branch, is clean.a_member_of_another_json_type_is_refused_before_its_value_is_checkedhas 41 rows. It checks the full text of each SerializationException by equality. On5aa21734b, with UpdateContinuousBackups removed from the new arm, the test failed at the UpdateContinuousBackups row. On23f962d3a, with the text forTableNamechanged instring_member, it failed at the firstTableNamerow.tests/test_backup_restore_fidelity.py37,tests/test_continuous_backups.py9,tests/test_authz_cross_account.py19,tests/test_authz_resource_arn.py49,tests/python/test_nul_table_name_fields.py52,tests/python/test_nul_arn_shapes.py48 andtests/python/test_warm_throughput_backup.py1. These tests include the three UpdateContinuousBackups rows with aTableNameof5. The 46 tests oftests/test_backup_job.pyskipped, because they start their own server fromEXTENDDB_BINARYand these runs did not set it.pytest --collect-only -qcollects 7301 tests intests/and 820 intests/python, with no error.bcd9f7f17, the three changed wire tests failed at the first new row of each. That commit is the fix(server): answer a restore's override kinds and account before its name #1284 head that this branch started from.test_a_missing_table_name_member_is_the_required_parameter_texthas three UpdateContinuousBackups rows with aTableNameof5: a disable, no specification, and an enable. The disable row failed against a build of5aa21734b, the first commit of this PR, without UpdateContinuousBackups in the new arm.5aa21734band to one built frombcd9f7f17. They got the answers shown.Line counts: production +33 -16, tests +127 -19, docs +5 -2. The tests count includes the 31 lines of the two corpus cases.
This PR adds no conflict with the open PRs or with
main. Since #1521 its table rows are indocs/webassembly.md, which #1127 and #1130 do not change.Not in this PR:
Messagethat DynamoDB uses for them (SerializationException carries its text undermessage, where DynamoDB sendsMessage#1143).BackupArnon a restore gets NULL, where DynamoDB answersInvalid Backup ARN(RestoreTableFromBackup answers a missing or malformed BackupArn with other texts than DynamoDB's Invalid Backup ARN #1272).TableNameor aBackupNameof another JSON type withValue null at 'tableName'orValue null at 'backupName'. On 3 December 2026 DynamoDB answered both with SerializationException (CreateBackup answers a TableName or BackupName of another JSON type as an absent member, where DynamoDB answers SerializationException #1553).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
The
BackupArnof RestoreTableFromBackup, DescribeBackup and DeleteBackup now gets SerializationException when the value is neither a string nor null. So does theTableNameof DescribeContinuousBackups and of an UpdateContinuousBackups that does not enable recovery. Before this change, they got a ValidationException, as the table in Why shows. A string or null member gets the same answer as before.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.