Repository navigation
fix(server): answer a restore's override kinds and account before its name - #1284
LeeroyHannigan wants to merge 7 commits into
Conversation
… name RestoreTableFromBackup answered a TargetTableName outside the pattern before two faults that DynamoDB answers first. These are an override member of another JSON kind and a BackupArn of another account. DynamoDB answers SerializationException for the first. For a BackupArn of an account that does not exist, it answers AccessDeniedException with "Access is denied". This was measured in us-east-1 on 20 Nov 2026, with each request sent twice. The service answers the name's length before the other override faults, such as a missing member, an unknown enum value or a fraction. When the server refuses the target name, it now first checks the JSON kind of each top-level override member. A member of another kind that the engine's override parse refuses gets the parse's SerializationException. The parse accepts a ProvisionedThroughputOverride list of two integers and a BillingModeOverride object of one key, so these two keep the name's answer (#1106). A request whose BackupArn names another account then goes on to the cross-account refusal. That refusal gives the answer a name the server accepts gets, and nothing before it looks a table up. A name the server accepts keeps its answer. Fixes #1245.
…ccount
Conflict in lib.rs, in the pub use backup::{...} list. This branch
adds check_restore_override_kinds to the list. Main moved
check_restore_table_name and refuse_point_in_time_recovery from the
list to backup_requests. This merge keeps main's list and adds
check_restore_override_kinds to it.
No test sent an OnDemandThroughputOverride of another JSON kind with a TargetTableName that the server refuses. A build without the OnDemandThroughputOverride arm of check_restore_override_kinds passed the engine backup tests and the gate tests. DynamoDB answers SerializationException to an OnDemandThroughputOverride of 5 with the target a*, measured in us-east-1 on 25 Nov 2026 with the request sent twice. The unit table of the gate and the wire table now have that row.
check_restore_override_kinds cloned the whole request body and then removed each member that is not an override of another JSON kind. It now copies only those overrides. The answers do not change.
The README lists the checks that the WebAssembly build does not make. Its row for a restore's TargetTableName outside the pattern said that the server checks only the BackupArn kind first. The server now checks the JSON kind of each override member before the name. It passes a BackupArn of another account to the accounts answer. The row gives that order, and the restore's length text, which counts UTF-16 code units. The paragraph on check order names the exception.
navareamol
left a comment
There was a problem hiding this comment.
CI has not finished on this head. The integration, cassandra-integration and mongodb-integration jobs were cancelled before any step ran, on 25 Nov between 22:24:54 and 22:24:57, and nothing ran after that. integration is also the job that runs devtools/test-shards check, so the check that the shards ran every test once did not run. wasm fails on web_time::Instant against std::time::Instant in crates/core/src/metrics/collector.rs:60, which #1482 fixed on main after this head was pushed. I merged main 222d80a into this head locally: no conflict, the engine, server and core lib tests pass, and the six wire files from the description pass on SQLite. Could you merge main so CI runs to the end on that tree?
A question on the account branch. With a BackupArn of an account the deployment holds, a refused name now gets "This action is only supported by accounts that match the resource owner's account." I measured that for a*, for t, U+0000, x and for a 200 KB name; before this change they got the length text or the pattern clause. The measured row OTHER gets "Access is denied", which ExtendDB gives for an account it does not hold, so I think OTHER was an account that does not exist. Has DynamoDB been asked a refused name with a BackupArn of an account that exists? If it answers the name, I think the gate should pass on only an account the deployment does not hold.
I will approve once CI is green on a branch with main merged and the account question has an answer.
…ccount 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 first puts the account of the BackupArn before the table names check of the TargetTableName. The second is the TargetTableName row of the table names check.
DynamoDB answers the account of the BackupArn before a TargetTableName outside the pattern. A BackupArn of an account that exists gets the ValidationException that the cross-account test calls OWNER_ONLY. One of an account that does not exist gets "Access is denied" (measured in us-east-1 on 3 Dec 2026). The cross-account test now sends "a b" with the BackupArn of the known and of the unknown account.
|
navareamol
left a comment
There was a problem hiding this comment.
The account question is answered. Your 3 December measurements show DynamoDB answering the account first for an account that exists as well, with the owner only text for a* and a b and for a valid name, and Access is denied for OTHER. That is what this head gives, so the gate stays as it is and my suggestion to pass on only the unknown account does not apply.
I ran the new cross account row, a b as the target name with the BackupArn of a known and of an unknown account, on a SQLite build of this branch with current main. It passes, and I checked that it detects the change: against a build of the new head of #1267 the known account gets the pattern clause at targetTableName, and with the account branch switched off the known account gets Access is denied. Unsigned, wrong secret, unknown key and tampered requests with every new branch still get the authentication errors first.
The README edits are in docs/webassembly.md now, main's README is untouched, and every check on 8a0bd88 is green. On the merged tree clippy with warnings as errors, fmt, the engine, server and core lib tests and the wasm adapter parity test pass.
I approve this PR.
Changes since the last review
a8189443camerges fix(server): refuse a restore's TargetTableName of another JSON type first #1267's new heade4d210f6a4, which containsmainatb3510a93ee. 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 two README edits of this PR indocs/webassembly.md. The other lines this PR changes stay the same.8a0bd882b2:test_other_account_answer_depends_on_operation_and_accountintests/test_authz_cross_account.pyalso sends a RestoreTableFromBackup with the refused namea b. It sends theBackupArnof the known account and of the unknown one, and expects the owner-only ValidationException andAccess is denied. DynamoDB gave these two answers on 3 December 2026, for an account that exists and for one that does not.What
When the server refuses the
TargetTableNameof a RestoreTableFromBackup, it now checks two other faults first, as DynamoDB does:BackupArnof another account goes on to the cross-account refusal. That refusal gives the answer that a request with an accepted name gets.Before this change, such a request got the answer for the name: the length text or the pattern clause at
targetTableName.The new function
check_restore_override_kindsincrates/engine/src/backup.rsdoes the kind check. It copies only the top-level override members whose JSON kind is not the model's. Then it runs the engine's two override parses on those members. The texts are the ones these parses give for a name the server accepts. A member of the model's kind does not go to the parses here. Its other faults keep the answer for the name, as on DynamoDB. These faults are a missing member, a value outside an enum, a throughput below 1 or a fraction.The gate change is in the
RestoreTableFromBackuparm ofcheck_table_name_charsincrates/server/src/table_name_gate.rs. It runs only for a refused name. The account check callscross_account::find, which the cross-account refusal also calls. Between the gate and that refusal,authorize_requestlooks up no table for this operation.The list of the six members and their kinds is a second copy. The parses hold the same names and kinds as code, in a match arm, a serde type and a helper. The filter cannot read them from there.
Two values of another kind keep the answer for the name, because the parse reads them with no error. These are a
ProvisionedThroughputOverridelist of two integers and aBillingModeOverrideobject of one key. DynamoDB answers SerializationException for both, with any name (#1106).For a
BackupArnof an account that exists in ExtendDB, every name now gets the owner-only ValidationException (This action is only supported by accounts that match the resource owner’s account.). DynamoDB gave that answer on 3 December 2026 to aBackupArnof an account that exists. The answer was the same with a name it refuses and with one it accepts.The base of this PR is #1267.
Why
These are DynamoDB's answers, measured in us-east-1 on 20 and 21 November 2026, and on 25 November 2026 for
OnDemandThroughputOverride. Each request went out twice and got the same answer both times. Each request names a backup that does not exist. OWN is aBackupArnof the caller's account, and OTHER is one of an account that DynamoDB does not hold. EXISTING is one of an account that exists and is not the caller's. In ExtendDB, EXISTING is an account that the deployment holds. Each row has OWN unless it names anotherBackupArn. TheTargetTableNameisa*unless the row gives another name. SE is SerializationException. LENGTH isTableName must be at least 3 characters long and at most 255 characters long.Access is deniedAccess is denieda b, ort, U+0000,xAccess is deniedtargetTableNameAccess is denieda*ora b(3 December 2026)This action is only supported by accounts that match the resource owner’s account.GlobalSecondaryIndexOverride{}GlobalSecondaryIndexOverride{}, namea bLocalSecondaryIndexOverride{},SSESpecificationOverride5,ProvisionedThroughputOverride"x"orBillingModeOverride5OnDemandThroughputOverride5(measured on 25 November 2026)GlobalSecondaryIndexOverride{}orSSESpecificationOverride5, in either orderBackupArnxor noBackupArn, andGlobalSecondaryIndexOverride{}BillingModeOverridePAY, andSSESpecificationOverride5,GlobalSecondaryIndexOverride{}orProvisionedThroughputOverride"x"BillingModeOverridePAYorGlobalSecondaryIndexOverride[{}], in either orderAccess is deniedAccess is deniedBillingModeOverridePAYorPROVISIONED, aProvisionedThroughputOverridewith a member absent, below 1 or of 1.5, or an index entry with a missing member or a value outside its setProvisionedThroughputOverride[1, 1], orBillingModeOverride{"PROVISIONED": null}or{"PAY_PER_REQUEST": null}With this change, ExtendDB gives DynamoDB's exception type to each row but the last. In the SE rows, ExtendDB's text also names the member, and DynamoDB's texts are #1012. A name that the server accepts keeps its answer.
Fixes #1245
Testing done
At
8a0bd882b2, 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 279 cases of the corpus. The clippy step of the WebAssembly workflow, run on this branch, is clean.a_refused_restore_target_name_is_answered_after_the_types_and_the_accounthas 23 rows. One row sets the six override members to null, which DynamoDB answers with LENGTH. On a revision beforebcd9f7f17, with the two gate statements removed, the test failed at its first row. Onaa56f36e7, with theOnDemandThroughputOverridearm removed from the kind filter, it failed at theOnDemandThroughputOverriderow.test_backup_and_table_names_are_validatedhas 17 rows. Against a server built from8022210a8, the fix(server): refuse a restore's TargetTableName of another JSON type first #1267 head that this branch started from, the table failed at its first row.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 new row of the cross-account test and theOnDemandThroughputOverriderow of the wire table. The 46 tests oftests/test_backup_job.pyskipped, because they start their own server fromEXTENDDB_BINARYand these runs did not set it. The head of fix(server): refuse a restore's TargetTableName of another JSON type first #1267,e4d210f6a4, does not have the gate change. Against a server built from it, the cross-account test fails at the new row. There the known account'sBackupArnwitha bgets the pattern clause attargetTableName.pytest --collect-only -qcollects 7301 tests intests/and 820 intests/python, with no error.bcd9f7f17, the first commit of this PR, and got the answers shown. That run did not have theOnDemandThroughputOverriderow or the EXISTING rows.bcd9f7f17, names with U+0000 or of 204,800 characters got no HTTP 500. They went beside OTHER and beside theBackupArnof an account that exists in ExtendDB. Every answer on both backends was HTTP 400.Line counts: production +43 -3, tests +115, docs +4 -2.
This PR adds no conflict with the open PRs or with
main. #1273 merges cleanly with it.Not in this PR:
Access is deniedor the enum clause before an override of another JSON type, where DynamoDB answers SE (RestoreTableFromBackup answers another account or a BillingModeOverride outside its set before an override of another JSON type, where DynamoDB answers SerializationException #1278).BackupArnand the name length (RestoreTableFromBackup checks an override value before the BackupArn and the TargetTableName length, where DynamoDB checks those first #1271).BackupArngets other texts than DynamoDB's, also witha*(RestoreTableFromBackup answers a missing or malformed BackupArn with other texts than DynamoDB's Invalid Backup ARN #1272).BackupArnof another JSON type gets ValidationException, where DynamoDB answers SE (A BackupArn or a DescribeContinuousBackups TableName that is not a JSON string answers ValidationException, where DynamoDB answers SerializationException #1263).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
When the server refuses a restore's
TargetTableName, it now answers two other faults before the name. An override member of another JSON kind gets SerializationException, and aBackupArnof another account gets the cross-account answer. Before this change, these requests got the length text or the pattern clause of the name, as the table in Why shows. A name that the server accepts keeps its answer.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.