Skip to content

fix(server): refuse a BackupArn or TableName of another JSON type first - #1291

Open
LeeroyHannigan wants to merge 5 commits into
fix/1245-restore-name-after-accountfrom
fix/1263-backup-arn-type
Open

LeeroyHannigan wants to merge 5 commits into
fix/1245-restore-name-after-accountfrom
fix/1263-backup-arn-type

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Changes since the last review

What

The server now refuses these members with a SerializationException when the value is neither a string nor null:

  • The BackupArn of RestoreTableFromBackup, DescribeBackup and DeleteBackup.
  • The TableName of 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_member in crates/server/src/table_name_gate.rs does the check. check_table_name_chars calls it before authorization. The text is the one that a restore's TargetTableName of another type already gets: Start of structure or map found where not expected: <member>. The inline check of TargetTableName now calls the same function. A null member is still an absent member.

On a restore, the BackupArn check comes after the type check of TargetTableName. 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 TableName of another JSON type as absent. The table of docs/webassembly.md now 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-target unless the row gives another name.

  • SE is SerializationException.
  • NULL is 1 validation error detected: Value null at 'backupArn' failed to satisfy constraint: Member must not be null.
  • REQUIRED is The parameter 'TableName' is required but was not present in the request.
  • LENGTH is TableName must be at least 3 characters long and at most 255 characters long.
  • SPEC is 1 validation error detected: Value null at 'pointInTimeRecoverySpecification' failed to satisfy constraint: Member must not be null.
Request DynamoDB ExtendDB on #1284 ExtendDB with this PR
RestoreTableFromBackup, BackupArn 5, true, {}, [], ["a"] or 5.5 SE NULL SE
RestoreTableFromBackup, BackupArn 5, target name a* before or after it SE LENGTH SE
RestoreTableFromBackup, BackupArn 5, target name ab or no target name SE NULL SE
RestoreTableFromBackup, BackupArn 5, BillingModeOverride PAY before or after it SE the enum clause at billingModeOverride SE
RestoreTableFromBackup, BackupArn 5, GlobalSecondaryIndexOverride [{}] SE SE SE
RestoreTableFromBackup, BackupArn 5, TargetTableName 5 SE SE SE
RestoreTableFromBackup, BackupArn null ValidationException Invalid Backup ARN NULL NULL (#1272)
DescribeBackup or DeleteBackup, BackupArn 5 or {} SE NULL SE
DescribeContinuousBackups, TableName 5, true, {}, [] or 5.5 SE REQUIRED SE
DescribeContinuousBackups, TableName null REQUIRED REQUIRED REQUIRED
DescribeContinuousBackups, a table that does not exist TableNotFoundException TableNotFoundException TableNotFoundException
UpdateContinuousBackups, TableName 5, recovery disabled SE REQUIRED SE
UpdateContinuousBackups, TableName 5, no PointInTimeRecoverySpecification (also on 3 December 2026) SE REQUIRED SE
UpdateContinuousBackups, a table that does not exist, no PointInTimeRecoverySpecification SPEC SPEC SPEC
UpdateContinuousBackups, TableName 5, recovery enabled (also on 3 December 2026) SE ContinuousBackupsUnavailableException ContinuousBackupsUnavailableException

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 5 backup_store::tests fail on every branch, because uid 65534 owns /local/home.
  • cargo +1.97.0 fmt --all -- --check is clean. cargo +1.97.0 clippy of the four crates with --all-targets -- -D warnings is clean, and so is the same command with --features extenddb-engine/backup-test-hooks. cargo +1.94.0 check of the four crates with --all-targets is 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.
  • The unit test a_member_of_another_json_type_is_refused_before_its_value_is_checked has 41 rows. It checks the full text of each SerializationException by equality. On 5aa21734b, with UpdateContinuousBackups removed from the new arm, the test failed at the UpdateContinuousBackups row. On 23f962d3a, with the text for TableName changed in string_member, it failed at the first TableName row.
  • Against ExtendDB on SQLite built from this head, 215 wire tests passed: tests/test_backup_restore_fidelity.py 37, tests/test_continuous_backups.py 9, tests/test_authz_cross_account.py 19, tests/test_authz_resource_arn.py 49, tests/python/test_nul_table_name_fields.py 52, tests/python/test_nul_arn_shapes.py 48 and tests/python/test_warm_throughput_backup.py 1. These tests include the three UpdateContinuousBackups rows with a TableName of 5. The 46 tests of tests/test_backup_job.py skipped, because they start their own server from EXTENDDB_BINARY and these runs did not set it. pytest --collect-only -q collects 7301 tests in tests/ and 820 in tests/python, with no error.
  • Against a server built from 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.
  • The table of test_a_missing_table_name_member_is_the_required_parameter_text has three UpdateContinuousBackups rows with a TableName of 5: a disable, no specification, and an enable. The disable row failed against a build of 5aa21734b, the first commit of this PR, without UpdateContinuousBackups in the new arm.
  • The rows of the table above went to a SQLite server built from 5aa21734b and to one built from bcd9f7f17. 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 in docs/webassembly.md, which #1127 and #1130 do not change.

Not in this PR:

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, 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 BackupArn of RestoreTableFromBackup, DescribeBackup and DeleteBackup now gets SerializationException when the value is neither a string nor null. So does the TableName of 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.

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 navareamol left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think two things need a change before this merges.

  1. CI on 23f962d has not finished. The integration gate 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. The wasm job failed on the Instant type 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?

  2. Two rows of the table in the description have no test. On this branch, UpdateContinuousBackups with {"TableName": 5} and no PointInTimeRecoverySpecification answers SerializationException, and with {"TableName": 5, "PointInTimeRecoverySpecification": {"PointInTimeRecoveryEnabled": true}} it answers ContinuousBackupsUnavailableException. I measured both on SQLite. The unit test calls check_table_name_chars only with the disable body, and the wire test sends only the disable body too. So if string_member moved 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 of test_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.
@LeeroyHannigan

Copy link
Copy Markdown
Collaborator Author

@navareamol

  1. 2f73542 merges the new head of fix(server): answer a restore's override kinds and account before its name #1284, which contains main at b3510a9. Its one conflict was README.md, where docs(readme): lead with a first request, move WebAssembly to its own page #1521 moved the WebAssembly section to docs/webassembly.md. The merge makes the README edits of this branch in docs/webassembly.md. There, the member types rows of this branch take the place of the row that fix(server): refuse a restore's TargetTableName of another JSON type first #1267 added for TargetTableName. CI runs on that tree after the push.
  2. 06402b5 adds both rows to the table of test_a_missing_table_name_member_is_the_required_parameter_text. {"TableName": 5} gets SerializationException. {"TableName": 5} with recovery enabled gets ContinuousBackupsUnavailableException with its text, the refusal that this file pins. On 3 December 2026 DynamoDB answered both with SerializationException.

The question: on 3 December 2026 DynamoDB answered both CreateBackup requests with SerializationException NUMBER_VALUE cannot be converted to String, each request sent twice. ExtendDB answers them with the null text at tableName and at backupName. #1553 tracks it.

@navareamol navareamol left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants