Skip to content

fix(server): ignore a TableName sent to an operation without one - #1296

Merged
LeeroyHannigan merged 1 commit into
mainfrom
fix/1281-no-table-name-member
Dec 4, 2026
Merged

LeeroyHannigan merged 1 commit into
mainfrom
fix/1281-no-table-name-member

Conversation

@LeeroyHannigan

Copy link
Copy Markdown
Collaborator

What

A TableName member sent to DescribeLimits, DescribeEndpoints, GetRecords, ExecuteStatement, BatchExecuteStatement or ExecuteTransaction no longer gets the table name checks. These operations have no member that holds a table name or ARN, and DynamoDB ignores the member.

Before this change, the server's table name gate refused a name or table ARN outside the pattern with ValidationException. The three PartiQL operations also refused another account's table ARN in that member with AccessDeniedException.

The new function has_no_table_member in crates/server/src/table_name_gate.rs lists the six operations. The gate skips them. cross_account::find in crates/server/src/authz_resource/cross_account.rs reads the same function, in place of its own list for three of them. ListStreams, ImportTable and ListTables keep their own arm there, because their requests have a member that holds a table name.

ExtendDB still refuses a PartiQL statement that names a table of another account by its ARN. This holds for a single statement, a batch and a transaction. That check reads the statement, not the stray member.

Fixes #1281

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. Each operation got the members it needs and each of these TableName values. OWN is the caller's account.

Value TableName
V0 arn:aws:dynamodb:us-east-1:OWN:table/
V5 arn:aws:dynamodb:us-east-1:OWN:table/a b
V2 arn:aws:dynamodb:us-east-1:OWN:table/ab
B1 a*
B2 ab
Z1 t, U+0000, x
Z2 arn:aws:dynamodb:us-east-1:OWN:table/t, U+0000, x
L1 256 times x
X1 arn:aws:dynamodb:us-east-1:111122223333:table/abc, another account
Operation Other members DynamoDB, for every value and with no TableName ExtendDB on main
DescribeLimits none 200, the account's limits ValidationException for V0, V5, B1, Z1 and Z2
DescribeEndpoints none 200, the endpoint list the same
ExecuteStatement a SELECT of a missing table ResourceNotFoundException the same, and AccessDeniedException for X1
BatchExecuteStatement one SELECT of a missing table 200, one response with the error ResourceNotFound the same, and AccessDeniedException for X1
ExecuteTransaction one SELECT of a missing table TransactionCanceledException with the reason ResourceNotFound the same, and AccessDeniedException for X1
GetRecords ShardIterator of 8 times x ValidationException Invalid ShardIterator ValidationException for V0, V5, B1, Z1 and Z2

With this change, every value gets the answer of the same request without TableName, as on DynamoDB: 54 of 54 requests, against 21 on main.

Testing done

  • cargo test -p extenddb-server --lib: 514 passed. On this host 5 backup_store::tests fail on every branch, because uid 65534 owns /local/home.
  • cargo +1.97.0 clippy -p extenddb-server --all-targets -- -D warnings and cargo +1.97.0 fmt --all -- --check are clean.
  • The unit test a_table_name_is_ignored_where_the_request_has_no_table_member sends the nine values to the six operations, through the gate and through cross_account::find. With both production changes reverted, it fails at its first value.
  • The new class in tests/test_misc_operations.py sends each value to each operation and compares the answer with the answer to the request without TableName. It passed on SQLite and on PostgreSQL. Against a server built from main, it fails 6 of 6.
  • The 54 other wire files that send these operations passed 3503 tests against ExtendDB on SQLite. Two TestConsoleIsolation tests failed with a certificate error, on main too.
  • Some requests had PartiQL statements that name a table of another account by ARN, or a table by its bare name. They got the same answers from this change and from main, with and without a stray TableName.
  • The rows of the table above went to SQLite and PostgreSQL servers built from this change, and no answer was HTTP 500. Those servers ran the commit before its last amend. That amend moved the new function, the new arm and the unit test, and shortened two doc comments.

Line counts: production +21 -3, tests +132 -2.

streams_client is now in 9 test files, and _answer is the fourth helper in tests/ that swaps a request body before the call. tests/conftest.py has no shared fixture for either, so this PR adds its own copies.

This PR adds one conflict, with #874, in crates/server/src/authz_resource/cross_account.rs. With this PR, DescribeLimits no longer gets the length check that #1282 adds for a table ARN.

Not in this PR: TransactGetItems and TransactWriteItems refuse a stray top-level TableName with a SerializationException, while BatchGetItem and BatchWriteItem ignore it. DynamoDB's answers for these four are not measured.

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


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.

DescribeLimits, DescribeEndpoints, GetRecords, ExecuteStatement,
BatchExecuteStatement and ExecuteTransaction have no member that holds a
table name or ARN. The server still ran the table name checks on a
TableName sent to them. It refused a name or table ARN outside the
pattern with ValidationException. The three PartiQL operations also
refused another account's table ARN with AccessDeniedException.

DynamoDB ignores the member. On 21 Nov 2026 in us-east-1 it answered
each such request as the same request without TableName. Nine values
went to each operation, each one twice.

The table name checks and the cross-account refusal now skip these
operations. Both read the list from one function.

Fixes #1281.

@demohan demohan 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.

A stray TableName is ignored as the service ignores it at 94ae7e7. For DescribeLimits, DescribeEndpoints, GetRecords and the three PartiQL operations, all 20 TableName values (valid, short, long, ARNs of this and another account, other JSON types, null) answer as in us-east-1, sent twice: 120 of 120 on SQLite and PostgreSQL, against 87 of 120 on main, and those 33 rows are the only ones of the 320 this changes. ListTables, BatchGetItem, BatchWriteItem and ListBackups answer as on main. With a user denied on the stray table, one allowed only on it and one with no policy, no stray value changes any answer except on ListBackups, where TableName is its own member, and this head and main agree on every value both let through, so no caller gains or loses access. Four controls fail as they should, the new wire tests fail 6 of 6 on main on both backends and pass here, fmt, both clippy configurations, 519 server tests and the 1.91.1 check are clean, and it merges onto main at 222d80a, where it builds and passes the 1.94.0 check and 527 server tests. The conflict the body reports with #874 is limited to cross_account.rs.

}

#[test]
fn a_table_name_is_ignored_where_the_request_has_no_table_member() {

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.

Optional. This test and STRAY_TABLE_NAMES in test_misc_operations.py send strings only; the service also ignores 5, true, an object, a list and null as TableName in all six operations (30 of 30, twice). This head and main already do, so rows for them would only hold it. The file is now 801 lines; the test could move to a sibling module.

@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 44a7b79 Dec 4, 2026
58 checks passed
@LeeroyHannigan
LeeroyHannigan deleted the fix/1281-no-table-name-member branch December 4, 2026 02:47
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 44a7b79, four commits past db8a90d: #1466, #1087, #768
and #1296. #1087 adds its v1.2.0 entry to
docs/manuals/07-upgrade-manual.md after the other v1.2.0 entries of
main, where this branch has its entry. That is the one conflict. The
merge keeps both entries without change: the entry of #1087 first, then
the entry of this branch, before the v1.1.0 entries.

Git merged three other files with no conflict:

- CONTRIBUTING.md: #1466 describes devtools/freeze-migrations in the
  step that freezes the released bodies. This branch gives the example
  migration the id 14 and adds migration 13 to the list of ids in use.
- crates/storage-mongodb/src/data_engine.rs: #1087 computes the
  parallel Scan segment with scan_segment in scan_key_in_segment and in
  scan_impl. This branch changes other functions.
- crates/storage/src/util/mod.rs: #1087 declares and exports
  scan_segment, and this branch declares and exports control_chars.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 44a7b79, five commits past c057660: #1531, #1466, #1087,
#768 and #1296. In docs/manuals/07-upgrade-manual.md, #1531 adds a
v1.2.0 entry at the top of "Behavior Changes by Release", and git
merged it with no conflict. #1087 adds its v1.2.0 entry after the other
v1.2.0 entries of main, where this branch has its entry. That is the one
conflict. The merge keeps both entries without change: the entry of
#1087 first, then the entry of this branch, before the v1.1.0 entries.

Git merged crates/storage-sqlite/src/data/query_scan.rs with no
conflict. #1087 replaces the rowid rule of the parallel Scan with the
SQL function extenddb_scan_segment. It computes the segment of a start
key from the key alone. This branch sets creation_date_time in
the TableKeyInfo of the test helper key_info. The tests that #1087 adds
in crates/storage-sqlite/src/scan_segment_tests.rs build each
TableKeyInfo from a clone, so they need no change for the new field.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 44a7b79, six commits past c8e66fb: #1446, #1531, #1466,
#1087, #768 and #1296. In docs/manuals/07-upgrade-manual.md, #1446 and
#1531 add v1.2.0 entries at the top of "Behavior Changes by Release",
and git merged them with no conflict. #1087 adds its v1.2.0 entry after
the other v1.2.0 entries of main, where this branch has its entry. That
is the one conflict. The merge keeps both entries without change: the
entry of #1087 first, then the entry of this branch, before the v1.1.0
entries.

Git merged five other files with no conflict:

- crates/storage-cassandra/tests/direct_integration.rs: #1531 declares
  the update_item_retry module, and this branch declares
  gsi_backfilling.
- crates/storage-mongodb/src/table_engine.rs: #1446 changes DeleteTable.
  It marks the table DELETING by table_id, and it removes the tags and
  the table document in one transaction. This branch changes
  create_table_impl_inner, index_info_by_table_id_impl and
  doc_to_table_description_in.
- crates/storage-sqlite/src/lib.rs: #1087 declares the
  scan_segment_tests module, and this branch declares
  gsi_backfilling_tests.
- crates/storage-sqlite/src/store.rs: #1087 registers
  extenddb_scan_segment on each connection of the pool. This branch
  adds the gsi_backfills field and gsi_creating_phase_delay.
- crates/storage/src/lib.rs: #1087 rewrites the doc comment of
  scan_key_in_segment, and this branch declares the gsi_backfill
  module.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 44a7b79, five commits past c057660: #1531, #1466, #1087,
#768 and #1296. In docs/manuals/07-upgrade-manual.md, #1531 adds a
v1.2.0 entry at the top of "Behavior Changes by Release", and git
merged it with no conflict. #1087 adds its v1.2.0 entry after the other
v1.2.0 entries of main, where this branch has its entry. That is the one
conflict. The merge keeps both entries without change: the entry of
#1087 first, then the entry of this branch, before the v1.1.0 entries.

Git merged two other files with no conflict:

- crates/storage-mongodb/src/data_engine.rs: #1087 computes the
  parallel Scan segment with scan_segment in scan_key_in_segment and in
  scan_impl. This branch changes the write functions and their retries
  at other lines.
- crates/storage/src/lib.rs: #1087 rewrites the doc comment of
  scan_key_in_segment, and this branch declares the request_clock
  module.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 44a7b79, six commits past c8e66fb: #1446, #1531, #1466,
#1087, #768 and #1296. In docs/manuals/07-upgrade-manual.md, #1446 and
#1531 add v1.2.0 entries at the top of "Behavior Changes by Release",
and git merged them with no conflict. #1087 adds its v1.2.0 entry after
the other v1.2.0 entries of main, where this branch has its entry. That
is the one conflict. The merge keeps both entries without change: the
entry of #1087 first, then the entry of this branch, before the v1.1.0
entries.

Git merged four other files with no conflict:

- Cargo.lock: #1087 adds crc32fast to the dependencies of
  extenddb-storage, and this branch adds form_urlencoded and tempfile to
  the dependencies of extenddb-storage-sqlite.
- crates/storage-sqlite/Cargo.toml: #1087 rewrites the comments of
  libsqlite3-sys and sqlite-wasm-rs. This branch adds form_urlencoded
  and the tempfile dev-dependency.
- crates/storage-sqlite/src/lib.rs: #1087 declares the
  scan_segment_tests module, and this branch declares file_mode and
  sqlite_uri.
- crates/storage-sqlite/src/store.rs: #1087 registers
  extenddb_scan_segment on each connection of the pool, in
  after_connect. This branch calls file_mode::prepare before the pool
  connects, and it removes the mode change after the connect. The pool
  keeps the after_connect of main.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 44a7b79, four commits past db8a90d: #1466, #1087, #768
and #1296. #1087 adds its v1.2.0 entry to
docs/manuals/07-upgrade-manual.md after the other v1.2.0 entries of
main, where this branch has its entry. That is the one conflict. The
merge keeps both entries without change: the entry of #1087 first, then
the entry of this branch, before the v1.1.0 entries.

Git merged two other files with no conflict:

- crates/storage-mongodb/src/data_engine.rs: #1087 computes the
  parallel Scan segment with scan_segment in scan_key_in_segment and in
  scan_impl. This branch changes the TransactWriteItems functions at
  other lines.
- crates/storage/src/lib.rs: #1087 rewrites the doc comment of
  scan_key_in_segment, and this branch adds the transact exports.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 44a7b79, six commits past c8e66fb: #1446, #1531, #1466,
#1087, #768 and #1296. In docs/manuals/07-upgrade-manual.md, #1446 and
#1531 add v1.2.0 entries at the top of "Behavior Changes by Release",
and git merged them with no conflict. #1087 adds its v1.2.0 entry after
the other v1.2.0 entries of main, where this branch has its entry. That
is the one conflict. The merge keeps both entries without change: the
entry of #1087 first, then the entry of this branch, before the v1.1.0
entries. No other file has changes on both sides.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
…-time

The merge takes f583547, the last head of #1093 before main merged
it as 1e2ebdd. The last merge took b8f73c4. Since then, #1093
merged main at 1174651, eight PRs past db8a90d: #1466, #1087,
#768, #1296, #1485, #1228, #1325 and #1443. Git merged without a
conflict. Two files of this branch have changes on both sides:

- crates/storage/src/util/mod.rs: #1087 declares and exports
  scan_segment, and this branch declares and exports throughput.
- docs/differences-from-dynamodb.md: #1443 changes the
  control_plane_delay_seconds default to 0.25 in two rows, and this
  branch adds the LastIncreaseDateTime row to the Control Plane table.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 1e2ebdd, ten commits past db8a90d: #1466, #1087,
#768, #1296, #1485, #1228, #1325, #1443, #1269 and the squash commit
of #1093.

One file conflicted: docs/manuals/07-upgrade-manual.md. #1093 adds its
v1.2.0 entry at the top of "Behavior Changes by Release", where this
branch has its entry. The merge keeps both entries without change. The
entry of this branch stays first. The entry of #1093 comes next, above
the other v1.2.0 entries of main. #1087 adds its entry after the other
v1.2.0 entries of main, and git merged it with no conflict.

Git merged four other files with no conflict:

- crates/core/src/validation/mod.rs: #1228 adds the pattern clause for
  an empty value in validate_name_member. This branch declares the
  table_name_length module near the top of the file.
- crates/server/src/table_name_gate.rs: #1296 adds has_no_table_member
  and an arm of check_table_name_chars for the six operations that have
  no table member. This branch checks none of those operations.
- crates/wasm-adapter/parity/corpus.json: #1087 adds a Scan case, and
  #1228 changes the text of a ListBackups case. This branch changes
  other cases.
- docs/manuals/10-security-model.md: #1325 adds the
  Content-Security-Policy line of the console. This branch changes the
  line on the requests that get an answer before the IAM decision.
LeeroyHannigan added a commit that referenced this pull request Dec 4, 2026
Main is at 1e2ebdd, eight commits past 5826e1b: #768, #1296,
#1485, #1228, #1325, #1443, #1269 and the squash commit of #1093.

Three files conflicted, in four hunks. In each hunk the UpdateTable
window of #1093 meets the answer of this branch for a DELETING table:

- crates/storage-postgres/src/update_table.rs and
  crates/storage-sqlite/src/update_table.rs have one hunk each. #1093
  reads three more columns of the table row: the stored throughput, the
  table class and the window (in_window on PostgreSQL,
  stored_transition_at on SQLite). This branch answers a DELETING table
  with TableBeingDeleted right after UpdateTable reads the row. The
  merge keeps the wider read of #1093, then the DELETING check of this
  branch, then the check for a status other than ACTIVE. The window
  checks of #1093 come after that check, as on main.
- crates/storage-mongodb/src/table_engine.rs has two hunks, both in
  require_active_table. #1093 makes the function return the catalog
  document of the table, and UpdateTable reads the window from it. This
  branch answers DELETING with TableBeingDeleted in a match on the
  status. The merge keeps that match, and its ACTIVE arm returns the
  document. The doc comment names the document and the three answers.

A table has one stored status. #1093 reports UPDATING only for a
stored ACTIVE table whose status_transition_at is later than now
(reported_status in crates/storage/src/util/mod.rs). So no table is
UPDATING and DELETING at the same time, and the merge does not choose
between the two answers.

Git merged six other files of this branch with no conflict:

- crates/engine/src/update_table.rs: #1093 changes the doc comment of
  handle_update_table and declares the status_tests module. This branch
  maps TableBeingDeleted in update_table_err_to_dynamo.
- crates/storage-cassandra/src/update_table.rs: #1093 reads
  status_transition_at and adds the window. This branch adds the same
  DELETING check before the check for a status other than ACTIVE.
- crates/storage-postgres/tests/table_snapshot.rs: #1093 writes
  CREATING instead of UPDATING in two fixtures. This branch changes
  other tests.
- crates/storage/src/error.rs: #1093 adds a sentence to the doc comment
  of IndexesInUse, and this branch adds TableBeingDeleted.
- docs/differences-from-dynamodb.md: #1443 changes the default delay
  to 0.25 s, and #1093 changes the row on stream disable and the row of
  the delay setting. This branch adds the row on requests during a
  DELETING window.
- docs/manuals/07-upgrade-manual.md: #1093 adds its v1.2.0 entry at the
  top of "Behavior Changes by Release". The entry of this branch stays
  after the v1.2.0 entries of main. The change of this branch to the
  entry of #1411 stays too.
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.

The server checks a TableName member on DescribeLimits, which has none, and refuses a table ARN that DynamoDB ignores

2 participants