Skip to content

fix(tagging): validate tag keys and values against the service grammar - #485

Open
LeeroyHannigan wants to merge 20 commits into
mainfrom
fix/tag-key-value-validation
Open

LeeroyHannigan wants to merge 20 commits into
mainfrom
fix/tag-key-value-validation

Conversation

@LeeroyHannigan

@LeeroyHannigan LeeroyHannigan commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Changes since the last review

Three commits sit on top of 857ffe5, the head of the review of 2026-11-24:

  • c317c72 moves the index name, table throughput and GSI throughput minimum checks of CreateTable ahead of the U+017F prefix check, where the service makes them. validate_create_table now runs the table name check, then validate_create_table_constraints, then validate_create_table_definition. handle_create_table runs the prefix check between the two groups. Eleven rows join tests/test_tag_check_order.py.
  • 64e802b adds a unit test that sends an index ARN and an export ARN through validate_arn_shape_and_account, which now takes the account ID and the region.
  • dd3d600 merges main at b0d1c64, which holds feat(wasm): [Add WebAssembly browser support for ExtendDB #1009 (3534c9e, the WebAssembly build). Four files conflicted:
    • crates/core/Cargo.toml: the unicode-general-category entry stays after uuid, and the entries that main added follow it.
    • The license notice files: all four are generated again from the merged Cargo.lock, and their four checks pass.

The What, Overlap and Testing done sections below describe the first two commits. The "Not changed here" bullet on the throughput order is gone.

On dd3d600, with toolchain 1.97.0:

  • The fmt check of .github/workflows/fmt.yml and the two clippy commands of .github/workflows/clippy.yml with -D warnings are clean.
  • The clippy step of .github/workflows/wasm.yml for wasm32-unknown-unknown is clean. This host has no clang, so the run used a stand-in C compiler and archiver. Clippy does not link.
  • Lib tests: extenddb-core 1177 passed and 1 ignored, extenddb-engine 894 passed, extenddb-server 514 passed and 5 failed. The five are backup_store tests. They fail on this host because another user owns /local/home, an ancestor of the directories they create.
  • tests/test_tag_check_order.py and tests/test_tag_validation.py pass 193 tests against ExtendDB on SQLite.
  • python3 -m pytest --collect-only -q of tests/ (6853 tests) and of tests/python (672): no error.

Three earlier commit messages are no longer true at this head. ef3bb70 says "up to 128 characters for a key and 256 for a value" and "reads Unicode general categories through unicode-properties". It also says "The same grammar already governs IAM user and role tags". The lengths count UTF-16 code units, the categories come from unicode-general-category, and the IAM grammar is a second copy. edb5d82 says Cargo.lock is unchanged, and it gains the unicode-general-category package. The merge 3966fc8 names a unicode-properties dependency in crates/core/Cargo.toml that the crate no longer has. The history is left as the reviewers saw it. Whoever merges: please use the What section of this body as the squash message.

What

ExtendDB now checks tag keys and values in one place, against the service's grammar. The messages and the check order come from measurements against the service.

crates/core/src/validation/tag.rs is new and holds the whole rule set: validate_tags, validate_tags_member, validate_tag_keys and validate_folded_tag_prefix, over the private per-tag checks validate_tag_key and validate_tag_value. validate_tags_member reads the raw Tags member for handle_create_table and for the server gate, so the check has one copy. The character test reads Unicode 13.0 general categories through unicode-general-category 0.4.0, pinned with =0.4.0 because it is the last release with 13.0 tables (Apache-2.0, no dependencies). The service refuses letters and digits that Unicode 14.0 and later assign. unicode-properties, which the repository uses for the IAM user and role tag grammar in crates/server/src/management/mod.rs, carries Unicode 17.0 tables.

char::is_alphabetic is a different test. It is the Alphabetic property, a superset of \p{L} that admits Other_Alphabetic combining marks such as U+093E, which the service rejects. An ASCII-space-only separator test would reject the \p{Z} separators the service accepts.

unicode-properties moves into [workspace.dependencies] and crates/server takes it from there. Cargo.lock gains the unicode-general-category package, and the four license notice files are regenerated.

The grammar now has two implementations, this one and is_iam_tag_char in crates/server/src/management/mod.rs. Making the IAM check call this one is a change to the IAM path, and the Unicode version IAM tags follow is not measured. #1390 covers that measurement and the shared check.

Three entry points run the check:

  • handle_tag_resource checks the keys and values, and the U+017F prefix after the table lookup.
  • handle_untag_resource checks TagKeys, which the service holds to the same key rules. It accepts a U+017F prefix, as the service does.
  • handle_create_table deserializes the body first and returns a member of the wrong JSON type at once, as SerializationException. Then it checks the TableName length and pattern, then CreateTable.Tags, then the enum members, then a missing member. The backends store those tags in the same rows TagResource writes, so CreateTable stored an invalid key as well.

The type check is the typed deserialization, with its result held until the TableName and Tags checks ran. A table of the top-level members and their JSON kinds was the other option. The deserialization already exists, covers nested members too, and leaves a missing member and an enum value outside its set where they were. The wrong-type class is serde's invalid type failure, with a null member left out: the service reads a null member as a missing one. The service's answer for a nested member of the wrong type, such as a KeySchema element with a number for AttributeName, is not measured. ExtendDB answers SerializationException for it, as main does. serde reports the first fault it meets, in member name order. When an enum value outside its set sorts before the mistyped member, as BillingMode does before Tags, the enum fault comes first. Such a request keeps the answer main gives, and #1109 lists those rows.

The service checks the U+017F prefix of CreateTable in the middle of the checks of validate_create_table. It reports the index names, the table's throughput against its billing mode and the throughput minimum of a provisioned table's GSIs before the prefix. It reports two HASH keys, a third key schema element and an undefined or unused attribute definition after the prefix. It also reports a GSI throughput on an on-demand table and StreamEnabled without a view type after it. So validate_create_table runs the table name check and then two groups, validate_create_table_constraints and validate_create_table_definition, and handle_create_table runs the prefix check between them. The second group holds every other check, in its old order and after the prefix, as at 857ffe5. The index name check moves out of the GSI and LSI key schema loops into the first group. So each check runs once on this path. Without tags, CreateTable now reports the first group's faults before the key schema and attribute definition faults too. For the throughput, the service does the same. Without tags, a PROVISIONED table without throughput and with an undefined key attribute gets the throughput refusal (measured 2026-11-20, in the #1109 comments). For an index name, that order follows from the rows of 2026-11-24 and is not measured without a tag.

RestoreTableFromBackup checks its target with validate_create_table, which runs the two groups in the same order. A restore takes its index names, key schemas and attribute definitions from the backup, which CreateTable or UpdateTable accepted. So only the throughput checks of the first group can refuse it, and its answers stay as they were. The order changes a restore's answer only when a stored definition fails a definition check and an override fails a throughput check. Then the throughput refusal comes first. ImportTable does not run validate_create_table.

The server's pre-authorization gate refuses a table ARN whose table segment is outside the name pattern. check_tag_resource_arn in crates/server/src/arn_gate.rs now runs the request's tag check first, through validate_request_tags in crates/server/src/request_tags.rs, because the service reports an invalid tag before that segment. The gate still refuses a bad stream ARN before the tags.

The tag checks sit where the service applies them, between the ARN account check and the region check, so validate_resource_arn in crates/engine/src/tagging.rs is split into validate_arn_shape_and_account and validate_arn_region_and_table. The first half returns the parsed ArnFields and the second half takes them, so the ARN is parsed once. An invalid tag key on a cross-region or cross-partition table ARN, and on an ARN naming no existing table, now reports the tag. On a cross-account ARN the server still denies the request. ListTagsOfResource carries no tags and calls both halves through the unchanged validate_resource_arn. A stream ARN with another partition, service or region gets Invalid StreamArn in the first half, before the tags.

docs/manuals/07-upgrade-manual.md gains a v1.1.0 entry under Behavior Changes by Release. It lists these rules. It also says that a tag an earlier release stored outside the grammar stays listed and still takes part in aws:ResourceTag conditions. When UntagResource refuses its key, only DeleteTable removes it, so the entry tells operators to remove such tags with UntagResource before the upgrade. No migration rewrites them, because that would change what those conditions match without a request from the table's owner. docs/dynamodb-limits.md lists the tag key and value lengths as enforced, in UTF-16 code units, and its coverage table and unenforced-limits list follow. docs/technical-debt.md drops L-7.

Why

TagResource stored whatever tag keys and values the request carried. The service accepts a tag key or value built from Unicode 13.0 letters, numbers and separators plus _ . : / = + - @. It accepts up to 128 UTF-16 code units in a key and 256 in a value. It refuses a key prefixed with aws: in any case, and a key that reads aws: when the service reads U+017F as s. A client could create on ExtendDB a tag that cannot exist on the service. A policy conditioning on such a tag therefore behaved differently between the two.

Fixes #444

Not changed here

These are gaps on main that the measurements under Testing done exposed. Each has its own issue, and this branch leaves it alone:

Overlap with other open PRs

#599, #550 and #598 add refuse_while_deleting inside validate_resource_arn, the function this PR splits. DynamoDB checks the tag before the DELETING refusal (measured 2026-10-26, in the #444 comments). So the second of these to merge puts the refusal in validate_arn_region_and_table, after validate_tags.

These PRs now conflict with this one in crates/core/src/validation/mod.rs, at the checks this PR moves into validate_create_table_constraints:

The second to merge keeps the index name and throughput checks in validate_create_table_constraints, ahead of the prefix check, where the rows of 2026-11-24 put them. #1114 adds its TableClass and SSESpecification checks at the top of handle_create_table, which keeps them ahead of the prefix check as well.

Testing done

Service measurements

DynamoDB in us-east-1, principal arn:aws:sts::<account>:assumed-role/Admin/..., retries off, botocore parameter validation off, on existing tables unless the row says otherwise. After one accepted TagResource, the next tag mutation on the same table fails with LimitExceededException Table tags are being updated. So the measurement put all the accepted cases in one request and read them back afterwards.

UTC Request Response
2026-10-24T00:29Z TagResource key k!y, and # $ % & * ( , ; < ' " \ backtick ~ ^ ` { [ ?`, tab, newline, an emoji
2026-10-24T00:29Z TagResource value v!x, v#x, v$x, a tab, an emoji ValidationException The Tag Value provided is invalid, Value: <value>
2026-11-20T11:22Z TagResource value holding each of % & * ( , ; < ' " \ backtick ~ ^ ` { [ ?`, a newline, U+0301 or U+093E
2026-10-24T00:29Z TagResource key of 129 characters ValidationException invalid key
2026-10-24T00:29Z TagResource value of 257 characters ValidationException invalid value
2026-11-20T10:45Z TagResource key of 64 U+20000, and of 126 ASCII letters plus one U+20000 accepted
2026-11-20T10:45Z TagResource key of 65 U+20000, and of 127 ASCII letters plus one U+20000 ValidationException invalid key, so the length counts UTF-16 code units
2026-11-20T10:45Z TagResource value of 128 U+20000, and of 256 é accepted
2026-11-20T10:45Z TagResource value of 129 U+20000, and of 257 é ValidationException invalid value
2026-10-24T00:29Z TagResource key "" ValidationException The Tag Key provided is invalid, Key:
2026-11-20T10:45Z TagResource key k plus U+0870, U+1E290, U+10570, U+9FFD, U+16AC0 (Unicode 14.0), U+31350, U+11F04, U+1E4F0, U+1E030 (15.0), U+2EBF0 (15.1), U+1C89, U+105C0, U+1CCF0, U+10D40 (16.0), U+323B0, U+10940 (17.0) ValidationException invalid key
2026-11-20T10:45Z TagResource key k plus U+08BE, U+10E80, U+30000, U+0D04 (Unicode 13.0) accepted
2026-11-23T13:59Z TagResource on an ARN naming no existing table, key k plus U+01C5 (Lt), U+02B0 (Lm), U+00B2 (No) or U+2029 (Zp), then y ResourceNotFoundException, so each key passed the grammar check
2026-11-23T14:41Z TagResource on an ARN naming no existing table, key ok, value v plus U+01C5, U+02B0, U+00B2 or U+2029, then x ResourceNotFoundException, so each value passed the grammar check
2026-11-23T13:59Z TagResource on an ARN naming no existing table, key k U+200B y (a format character) ValidationException The Tag Key provided is invalid, Key: k<U+200B>y
2026-11-23T14:41Z TagResource on an ARN naming no existing table, key ok, value v U+200B x; and value v!x ValidationException The Tag Value provided is invalid, Value: <value>
2026-10-24T00:29Z TagResource key aws:foo, AWS:foo, Aws:foo, aws: ValidationException Tag Key cannot be prefixed with aws:, Key: <key>
2026-11-20T10:46Z TagResource key awſ:foo or AWſ:foo (U+017F) ValidationException One or more parameter values were invalid; on an absent table ResourceNotFoundException, and with k! later in the request the invalid key
2026-11-20T10:46Z UntagResource TagKeys awſ:foo accepted
2026-10-24T00:29Z TagResource key aws:k!, and aws: plus 130 characters ValidationException invalid key, so characters and length are checked before the prefix
2026-10-24T00:29Z TagResource [{k!, v!}] ValidationException invalid key, so the key is checked before its value
2026-10-24T00:29Z TagResource [{ok1, v!}, {k!, ok2}] ValidationException invalid value v!, so tags are checked in request order
2026-10-24T00:29Z TagResource [{k!, v}] on an ARN naming no existing table ValidationException invalid key, not ResourceNotFoundException
2026-10-24T00:29Z TagResource [{k!, v}] on a cross-account ARN AccessDeniedException Access is denied
2026-10-24T00:29Z TagResource [{k!, v}] on an index ARN ValidationException only table or stream is accepted
2026-11-20T10:45Z TagResource and UntagResource with k! on a stream ARN in eu-west-1, in aws-cn or for service s3 ValidationException Invalid StreamArn
2026-11-20T10:45Z TagResource and UntagResource with k! on table/bad!name, also in eu-west-1; with ok the invalid key; with ok, Invalid TableArn: Invalid ResourceArn provided as input <arn>
2026-10-24T00:29Z UntagResource TagKeys k!, "", a 129-character key ValidationException The Tag Key provided is invalid, Key: <key>
2026-11-20T11:22Z UntagResource TagKeys k#y, k plus tab, an emoji, U+093E or U+0870, and ["ok", "zk!", "ak#"] ValidationException invalid key, the first invalid key in request order
2026-11-20T11:22Z UntagResource TagKeys kéy, aws, a 128-character key, 64 U+20000 accepted
2026-10-24T00:29Z UntagResource TagKeys aws:foo ValidationException Tag Key cannot be prefixed with aws:, Key: aws:foo
2026-10-24T00:29Z CreateTable with Tags [{k!, v}] ValidationException The Tag Key provided is invalid, Key: k!
2026-11-20T10:47Z CreateTable with Tags [{ok, v!}], [{aws:owner, v}] the invalid value; Tag Key cannot be prefixed with aws:, Key: aws:owner
2026-11-20T10:47Z CreateTable with [{k!, v}] and an undefined key attribute, PROVISIONED without throughput, an enum value outside its set, two HASH keys, a missing KeySchema, a GSI without Projection or StreamEnabled without a view type the invalid key
2026-11-20T10:47Z CreateTable with [{k!, v}] and TableName ab, a 256-character TableName, bad!name, or no TableName the TableName error
2026-11-20T11:49Z CreateTable without tags, with TableName ab and BillingMode FOO, no KeySchema, or StreamEnabled without a view type the TableName length error
2026-11-23T14:24Z CreateTable with TableName ab and "Tags": "x"; and with [{k!, v}] and "KeySchema": "x" SerializationException Unexpected field type, so a member of the wrong JSON type comes before the TableName length and the tags
2026-11-23T14:19Z CreateTable without TableName, with BillingMode FOO, with and without [{k!, v}] ValidationException The parameter 'TableName' is required but was not present in the request
2026-11-24T05:40Z CreateTable with [{awſ:foo, v}] and ProvisionedThroughput on an on-demand table ValidationException One or more parameter values were invalid: Neither ReadCapacityUnits nor WriteCapacityUnits can be specified when BillingMode is PAY_PER_REQUEST
2026-11-24T05:40Z CreateTable with [{awſ:foo, v}], PROVISIONED without ProvisionedThroughput ValidationException One or more parameter values were invalid: ReadCapacityUnits and WriteCapacityUnits must both be specified when BillingMode is PROVISIONED
2026-11-24T05:40Z CreateTable with [{awſ:foo, v}], PROVISIONED with a throughput of 0, and with a throughput of 1 and a GSI throughput of 0 ValidationException 2 validation errors detected, with Value '0' at '<member>' failed to satisfy constraint: Member must have value greater than or equal to 1 for writeCapacityUnits and then readCapacityUnits of provisionedThroughput, or of globalSecondaryIndexes.1.member.provisionedThroughput
2026-11-24T05:40Z CreateTable with [{awſ:foo, v}] and a GSI or an LSI named g ValidationException 1 validation error detected: Value 'g' at 'globalSecondaryIndexes.1.member.indexName' failed to satisfy constraint: Member must have length greater than or equal to 3, or at localSecondaryIndexes.1.member.indexName
2026-11-24T05:40Z CreateTable with [{awſ:foo, v}] and SSESpecification with SSEType BAD ValidationException 1 validation error detected: Value 'BAD' at 'sSESpecification.sSEType' failed to satisfy constraint: Member must satisfy enum value set: [AES256, KMS]
2026-11-24T05:40Z CreateTable with [{awſ:foo, v}] and TableClass BAD ValidationException Invalid table-class parameter provided. Please try again with a valid table-class value: [STANDARD, STANDARD_INFREQUENT_ACCESS].
2026-11-24T05:40Z CreateTable with [{awſ:foo, v}] and an undefined key attribute, two HASH keys, a third key schema element or an unused attribute definition ValidationException One or more parameter values were invalid, the U+017F prefix refusal
2026-11-24T05:40Z CreateTable with [{awſ:foo, v}] and a GSI throughput on an on-demand table, OnDemandThroughput {MaxReadRequestUnits: 0} or StreamEnabled without a view type the same prefix refusal
2026-10-24T00:34Z TagResource with 19 tags covering A-Z a-z 0-9 space _ . : / = + - @, the letters é ß U+4E2D U+0434, U+00A0 (Zs), U+2028 (Zl), U+0663 (Nd), U+2167 (Nl), a leading space, a trailing space, a key of one space, the keys aws and xaws:foo, the value aws:foo, a 128-character key, a key of 128 two-byte characters, a 256-character value, an empty value accepted; ListTagsOfResource returned all 19 with their values unchanged
2026-10-24T00:34Z TagResource key holding U+0301 or U+093E, both combining marks ValidationException invalid key, so marks are outside the grammar
2026-10-24T00:34Z TagResource [{k!, v}] on a cross-region and on a cross-partition ARN ValidationException invalid key, so tags are checked before the region

The key and value lengths count UTF-16 code units. é is one unit and U+20000 is two, so the service accepts a key of 128 é and refuses a key of 65 U+20000. Each request of 2026-11-23 and 2026-11-24 was sent twice with the same answer, and none created, tagged or removed anything. After each CreateTable of 2026-11-24, DescribeTable on its name answered ResourceNotFoundException.

Tests

tests/test_tag_validation.py is new, with 102 tests:

  • the rejected character set in a key and in a value, including letters that Unicode 14.0 and later assign, and U+200B
  • the UTF-16 length boundaries and the empty key
  • the aws: prefix in four spellings, and the U+017F prefix
  • the accepted grammar, one key and one value per letter, number and separator category the service accepts, stored and read back through ListTagsOfResource
  • the same key rules on UntagResource, and CreateTable.Tags

tests/test_tag_check_order.py is new, with 91 tests. They hold the order of the tag checks against each other, against each ARN check on TagResource and UntagResource, and against the CreateTable definition. Two rows hold a member of the wrong JSON type. Each ARN shape asserts the full message, also with a valid key and on ListTagsOfResource. So the tests hold each caller of the split check to both halves. Twelve CreateTable rows hold the U+017F prefix against the checks of validate_create_table. Seven of them assert the full message: the on-demand throughput before the prefix, and the prefix before an undefined key attribute and five other faults. ExtendDB words the other five in its own texts (#1041, #1147, #904). Those rows assert HTTP 400, ValidationException and that the prefix refusal did not answer.

The requests use the dynamodb_client_no_validation fixture, because botocore enforces the model's own length bounds on the client and these tests measure what the server answers. botocore cannot write a string where the model has a list. So the two wrong-type rows put their JSON in place before the request is signed. They compare the error code only: the service words that refusal as its JSON reader does and ExtendDB as serde does.

At 82442c8, the 178 tests of both files passed against DynamoDB in us-east-1, on SQLite and on PostgreSQL. The four rows of e01414d and e97c5cf encode the measurements of 2026-11-23 above. Against the production code of 82442c8 with those tests kept, the two wrong-type rows fail and the other 180 pass. With the TitlecaseLetter, ModifierLetter, OtherNumber and ParagraphSeparator arms removed from is_tag_char, the core unit tests fail, where they passed at 82442c8. With the UntagResource key check moved after the region and table check, 5 of those 182 tests fail.

The eleven CreateTable rows of c317c72 encode the measurements of 2026-11-24 above. Against the production code of 857ffe5 with these tests kept, the six rows for the faults before the prefix fail and the other 187 pass. With the prefix check moved after both groups, the six rows for the faults after the prefix fail. On this branch all 193 pass on SQLite.

crates/core/src/validation/tag.rs carries 11 unit tests over the same measurements. They cover the character classes, both length boundaries, the prefix rule in four spellings, the U+017F prefix and the ordering of the checks. They also cover keys whose fourth byte falls inside a character, which must not split the four-byte prefix comparison. crates/engine/src/create_table.rs carries two unit tests. One holds which deserialization failures count as a member of the wrong JSON type, and the other holds the sentence for a missing TableName. crates/engine/src/tagging.rs carries two. One holds the table name of a parsed resource. The other sends an index ARN and an export ARN through validate_arn_shape_and_account and asserts each message. No wire test reaches these two checks, because the server's gate answers both ARNs before the engine runs. With either resource-kind check removed, that test fails.

Also run on SQLite at 64e802b: tests/test_stream_arn_scope.py, tests/test_resource_tag_migration.py, tests/test_misc_operations.py::TestTagResource, and the CreateTable files tests/test_table_throughput_mode.py, tests/test_table_operations.py, tests/test_multipart_gsi.py and tests/test_update_table_billing_validation.py. 70 passed and 2 skipped. CI runs the other files.

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

TagResource, UntagResource and CreateTable refuse tag requests that 1.0.0 accepted. That covers a key or value outside the grammar above or over the UTF-16 length. It also covers a key with the aws: prefix in any case or with U+017F for its s. A client that sends such a tag gets ValidationException where 1.0.0 stored it, or removed it on UntagResource. A key that an earlier release stored outside the grammar stays on its table after the upgrade. UntagResource refuses that key, so only DeleteTable removes the tag. The v1.1.0 entry of docs/manuals/07-upgrade-manual.md under Behavior Changes by Release lists the rules and the steps to take before upgrading.


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.

TagResource stored any tag key and value it was given. The service accepts a
key or value built from Unicode letters, numbers and separators plus
_ . : / = + - @, up to 128 characters for a key and 256 for a value, and
refuses a key prefixed with aws: in any case. A tag that cannot exist on the
service could be created on ExtendDB, so a policy conditioning on that tag
behaved differently between the two.

Tag keys and values are now checked in one place, crates/core/src/validation/tag.rs,
which reads Unicode general categories through unicode-properties. The same
grammar already governs IAM user and role tags in the management API.

TagResource, UntagResource and CreateTable.Tags all run the check: the
backends store CreateTable's tags in the same rows TagResource writes. Restore
and import build their own CreateTableInput below the CreateTable handler and
are unchanged.

The check sits where the service applies it, between the ARN account check and
the region check, so validate_resource_arn is split into its two halves. An
invalid tag key on a cross-region ARN or on an ARN naming no existing table
reports the tag; on a cross-account ARN the request is still denied.

Messages, boundaries and check order come from measurements against DynamoDB in
us-east-1 on 2026-10-24.
…source

The split of validate_resource_arn left the account half and the region and
table half separately callable, and only TagResource had tests for every ARN
shape. UntagResource with a valid key and ListTagsOfResource now have them
too: a cross-region, cross-partition or wrong-service ARN answers
ValidationException, an ARN naming no table answers
ResourceNotFoundException, and another account's ARN answers
AccessDeniedException, each measured against DynamoDB on 2026-10-24.

unicode-properties is declared once in the workspace table and used by
extenddb-core and extenddb-server; Cargo.lock is unchanged.
crates/core/Cargo.toml keeps the partiql feature from main and the unicode-properties dependency from this branch.
crates/core/src/validation/mod.rs keeps the restorable_item module and re-exports from main and the tag module and re-exports from this branch.
crates/engine/src/tagging.rs keeps the ArnFields value and the deployment_scope_error check from main inside the two halves this branch split validate_resource_arn into.

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

Three items block merge, and once items 1 to 9 below and the four test and wording items are done, this merges. Every measurement is us-east-1, 2026-11-20, each request sent twice with identical answers, compared against this head and the merge-base on SQLite; most were also run on PostgreSQL, MongoDB and Cassandra. Items not listed here (empty Tags, duplicate keys, more than 50 tags, null Key or Value, the four-field ARN message, CreateTable with duplicate keys returning 500 on SQLite and PostgreSQL) are on main too and will be filed separately.

Tags stored by an earlier release outside the grammar, such as k!, stay listed after upgrade and still drive aws:ResourceTag conditions, while TagResource and UntagResource now refuse them, so only DeleteTable removes them. A catalog migration through extenddb migrate, or at least a release note, covers that.

crates/server/src/arn_gate.rs:256: For TagResource and UntagResource, this gate answers before the tags are checked. TagResource on arn:aws:dynamodb:us-east-1:<acct>:table/bad!name with k!: the service answers The Tag Key provided is invalid, Key: k!; this head answers Invalid TableArn: Invalid ResourceArn provided as input .... With a valid key, both answer Invalid TableArn. The stream branch on line 255 stays ahead of the tags.


validate_resource_arn(&input.resource_arn, ctx).await?;
validate_arn_shape_and_account(&input.resource_arn, ctx)?;
validate_tags(&input.tags)?;

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 stream ARN outside the deployment now reports the tag. TagResource on arn:aws:dynamodb:eu-west-1:<acct>:table/t/stream/2026-01-01T00:00:00.000 with [{"Key":"k!","Value":"v"}]: the service and the merge-base answer ValidationException Invalid StreamArn; this head answers The Tag Key provided is invalid, Key: k!. The same holds for aws-cn, a non-dynamodb service, and UntagResource (line 278). The service defers the region check past the tags for table ARNs only. Returning Invalid StreamArn from validate_arn_shape_and_account for an out-of-deployment stream ARN fixes it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in a028ab4. validate_arn_shape_and_account now answers Invalid StreamArn for a stream ARN with another partition, service or region, before the tag checks. test_arn_checks_against_an_invalid_key holds the eu-west-1, aws-cn and s3 stream ARNs with k! on TagResource and UntagResource, and an in-region stream ARN for an absent table still reports the key.

Comment thread crates/core/src/validation/tag.rs Outdated
///
/// Returns `ValidationException`.
pub fn validate_tag_key(key: &str) -> Result<(), DynamoDbError> {
if key.is_empty() || key.chars().count() > MAX_TAG_KEY_CHARS || !key.chars().all(is_tag_char) {

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.

The service counts UTF-16 code units. A key of 64 U+20000 is accepted and 65 is refused with The Tag Key provided is invalid, Key: <key>; a value of 128 is accepted and 129 refused. This head accepts and stores keys up to 128 and values up to 256 such characters, on all four backends. encode_utf16().count() here and on line 82 matches the service. The comment on lines 12 to 14 needs the same correction.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in a028ab4. Both limits count encode_utf16() units, and the comment says so. The wire file refuses keys of 65 U+20000 and of 127 ASCII letters plus one U+20000, and a value of 129 U+20000. It stores keys of 64 U+20000 and of 126 ASCII letters plus one U+20000, and a value of 128 U+20000.

Comment thread crates/core/src/validation/tag.rs Outdated
fn is_tag_char(c: char) -> bool {
matches!(c, '_' | '.' | ':' | '/' | '=' | '+' | '-' | '@')
|| matches!(
c.general_category_group(),

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.

unicode-properties 0.1.4 uses Unicode 17 tables, and the service's letter and number set is Unicode 13.0. Keys k+U+0870, U+1E290, U+31350, U+2EBF0 and U+1C89 are refused by the service and accepted here. U+08BE, U+10E80 and U+30000 (Unicode 13) are accepted by both. Filtering by Derived Age 13.0 matches every case measured.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in a028ab4. The table tag grammar now reads the categories from unicode-general-category 0.4.0, pinned, the last release with Unicode 13.0 tables (Apache-2.0, no dependencies, notice files regenerated). The service also refuses U+10570, U+9FFD, U+16AC0, U+11F04, U+1E4F0, U+1E030, U+105C0, U+1CCF0, U+10D40, U+323B0 and U+10940. The 13.0 categories give the service's answer for all 25 code points. IAM tags keep unicode-properties.

Comment thread crates/engine/src/create_table.rs Outdated
// definition: a request carrying a valid definition and an invalid tag key
// is refused for the tag (measured). Restore and import build their own
// CreateTableInput further in and do not pass through this handler.
validate_tags(input.tags.as_deref().unwrap_or_default())?;

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.

The service checks Tags before the table definition. CreateTable with AttributeDefinitions [other:S], KeySchema [pk HASH] and Tags [{k!, v}] answers The Tag Key provided is invalid, Key: k!; this head answers Some index key attributes are not defined in AttributeDefinitions.... The same holds for PROVISIONED without throughput, vector indexes on PROVISIONED, enum errors and about ten other definition errors. Only the TableName length and pattern errors come first. Moving this call above validate_create_table matches the service, and the comment on lines 56 to 59 needs the same correction.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in a028ab4. The TableName and Tags checks now run first in handle_create_table, ahead of validate_enum_fields and the deserialization. A call right above validate_create_table would still report the enum errors and a missing KeySchema or Projection before the tag. A missing TableName and a bad TableName length also come before the tags. The comment is rewritten, and test_create_table_checks_the_tags_before_the_definition holds the definition errors.

// when 4 is not a character boundary.
if key
.get(..4)
.is_some_and(|prefix| prefix.eq_ignore_ascii_case("aws:"))

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.

awſ:foo (U+017F) is stored here. The service refuses it on TagResource and CreateTable with ValidationException One or more parameter values were invalid, after the grammar, duplicate, count and table-existence checks, and accepts it on UntagResource. eq_ignore_ascii_case does not fold U+017F to s.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in a028ab4. validate_folded_tag_prefix refuses a key that reads aws: when U+017F counts as s, with One or more parameter values were invalid. TagResource runs it after the table lookup, and UntagResource does not run it. On CreateTable the service reports it before the key schema, attribute definition and stream errors and before ResourceInUseException. So there it runs ahead of validate_create_table.

Comment thread crates/core/src/validation/tag.rs Outdated
///
/// Returns `ValidationException`.
pub fn validate_tag_value(value: &str) -> Result<(), DynamoDbError> {
if value.chars().count() > MAX_TAG_VALUE_CHARS || !value.chars().all(is_tag_char) {

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.

Changing this to value.len() passes every test. The service accepts a value of 256 é and refuses 257; that pair as a unit and a wire test would hold it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 8cd8a71. The unit test and the read-back wire test now accept a value of 256 é and refuse 257 é. With value.len() the wire test fails on the 256 é value.

Comment thread crates/core/src/validation/tag.rs Outdated
}

#[test]
fn a_multi_byte_first_character_does_not_split_the_prefix_check() {

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.

Replacing key.get(..4) with &key[..4] passes this test, because byte 4 falls on a character boundary in both keys. A key such as a\u{4e2d} makes byte 4 land inside a character.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

a\u{4e2d} is four bytes, so byte 4 is its end and &key[..4] does not split it. In 8cd8a71, the test uses ab\u{4e2d}, \u{e9}\u{4e2d} and abc\u{e9}, where byte 4 falls inside a character, and with &key[..4] it panics.

Comment thread tests/test_tag_validation.py Outdated
class TestCreateTableTags:
"""CreateTable.Tags are stored in the same rows, so the same rules apply."""

def test_create_table_rejects_an_invalid_tag_key(self, dynamodb_client_no_validation):

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.

If the server accepts the request, the table stays: on the merge-base one run left three tables. A finally that deletes the table, and a DescribeTable ResourceNotFoundException check in the value and prefix tests, keep it clean.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 8cd8a71. Every CreateTable refusal case goes through assert_create_table_refused, which checks that DescribeTable answers ResourceNotFoundException and deletes the table in a finally.

Comment thread tests/test_tag_validation.py Outdated
dynamodb_client_no_validation.tag_resource(
ResourceArn=":".join(fields), Tags=[{"Key": "k!", "Value": "v"}]
)
assert exc.value.response["Error"]["Code"] == "AccessDeniedException"

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.

This asserts the code only. The message Access is denied is fixed; the same applies on lines 515 and 536.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 8cd8a71. The cross-account case asserts Access is denied, and the ARN shape tests assert the full message for each shape on TagResource, UntagResource and ListTagsOfResource.

Comment thread tests/test_tag_validation.py Outdated
separators plus ``_ . : / = + - @``, up to 128 characters for a key and 256 for
a value, and refuses a key prefixed with ``aws:`` in any case. Every expected
response in this file was measured against DynamoDB in us-east-1 on
2026-10-24 and recorded in the builder report's Service measurements section,

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.

"recorded in the builder report's Service measurements section" describes how the file was produced. The date and region are enough. The PR body's table also omits several cases this file tests (value characters other than ! # $, tab and emoji; several UntagResource keys; CreateTable with an invalid value or aws:owner); those match the service when measured and belong in the table.

  1. Review-level note on stored tags (body, not inline):
    Tags stored by an earlier release outside the grammar, such as k!, stay listed after upgrade and still drive aws:ResourceTag conditions, while TagResource and UntagResource now refuse them, so only DeleteTable removes them. A catalog migration through extenddb migrate, or at least a release note, covers that.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 8cd8a71. The docstring gives the dates and the region only. The PR body table now lists the value characters, the UntagResource keys, and CreateTable with an invalid value and with aws:owner.

The rules below are the answers of DynamoDB in us-east-1 on 2026-11-20,
with each request sent twice.

- Lengths count UTF-16 code units. The service accepts a key of 64
  U+20000 and refuses one of 65. It refuses a key of 127 ASCII letters
  and one U+20000. It accepts a value of 128 U+20000 or 256 é, and
  refuses one more character.
- Letters, numbers and separators are those of Unicode 13.0. The service
  refuses U+0870, U+16AC0, U+31350, U+2EBF0, U+1C89 and U+323B0, which
  Unicode 14.0 to 17.0 assign. It accepts U+08BE, U+10E80 and U+30000.
  unicode-general-category 0.4.0 has the 13.0 tables, so the table tag
  grammar uses that version, pinned. IAM tags keep unicode-properties.
- The service refuses a key that reads aws: when U+017F reads as s
  (awſ:foo), with "One or more parameter values were invalid". On
  TagResource this check runs after the table lookup. UntagResource
  accepts the key.
- A stream ARN with another partition, service or region gets "Invalid
  StreamArn" before the tag checks.
- A table ARN with a table segment outside the name pattern reports an
  invalid tag key or value first, on TagResource and on UntagResource.
- CreateTable checks the TableName, then the Tags, then the rest of the
  request. A definition error together with an invalid tag reports the
  tag.
…3.0 rules

The check order cases move to tests/test_tag_check_order.py. The new
cases there are the answers of DynamoDB in us-east-1 on 2026-11-20 for
these requests:

- stream ARNs outside the deployment
- table ARNs with a bad table segment
- a foreign-service ARN in another account
- export and import ARNs
- CreateTable definition errors sent with an invalid tag

Each ARN case asserts the full message.

tests/test_tag_validation.py gets the UTF-16 length rows, the letters
that Unicode 14.0 and later assign, and the U+017F prefix. A CreateTable
refusal case now deletes its table in a finally block and checks that
DescribeTable answers ResourceNotFoundException. The read-back test waits
until the service lists the tags, and retries DeleteTable while it
answers ResourceInUseException.
The four license notice files conflicted, and cargo-about 0.9.0
regenerated them from the merged Cargo.lock.
DynamoDB in us-east-1 reports a TableName of two characters before a
BillingMode outside its set and before a missing KeySchema. It does so
with or without tags (each request sent twice on 2026-11-20). The early
TableName check in handle_create_table gives that order, and the head
answered the enum error and a SerializationException.
The behavior changes of the upgrade manual gain a v1.1.0 entry. It
lists the key and value rules that TagResource, UntagResource and
CreateTable now apply. It also states what happens to a tag that 1.0.0
stored outside those rules. ListTagsOfResource still lists it, and
aws:ResourceTag conditions still match it. When UntagResource refuses
its key, only DeleteTable removes it. The entry tells operators to
remove such tags with UntagResource before the upgrade, because 1.0.0
accepts any key there.
…TableName and the Tags

DynamoDB in us-east-1 answers SerializationException for a CreateTable
body with a member of the wrong JSON type. It does so ahead of a
TableName of two characters and ahead of an invalid tag (each request
sent twice on 2026-11-23). The head answered the TableName length and
the tag, because the early TableName and Tags checks ran before the
deserialization.

handle_create_table now deserializes the body first. A failure that
reports the wrong JSON type, serde's "invalid type", comes back at once.
Every other failure waits behind the TableName, Tags, enum and
StreamEnabled checks, where the deserialization ran before. So a missing
KeySchema beside an invalid tag still reports the tag, and a BillingMode
outside its set still gets the enum message. A null member is not a type
fault: the service reads it as a missing member. The error mapping moves
into input_error, which keeps the TableName sentence and reuses the
engine's deserialize_error for the rest.

Two wire rows hold the two measured requests by error code. The service
words the refusal as its JSON reader does and ExtendDB as serde does, so
#1109 keeps the message text. A unit test holds which serde failures
count as a type fault. The handler comment and the wire file's docstring
now state the measured order. A type fault comes first. A TableName of
bad length or outside the pattern comes next, then a missing TableName,
then the Tags, then the rest of the request.
…aph categories and U+200B

is_tag_char accepts eleven general categories, and no test held a
character of four of them: Lt, Lm, No and Zp. Removing those four arms
left every unit test passing. DynamoDB in us-east-1 accepts U+01C5 (Lt),
U+02B0 (Lm), U+00B2 (No) and U+2029 (Zp) in a tag key and in a tag
value. It refuses U+200B, a format character, in both. Each request went
twice on 2026-11-23 to a table ARN that names no table, so the grammar
check answered before the table lookup.

The four characters join the accepted keys and values of the unit test
and the ACCEPTED_TAGS table of the wire file. That test stores them and
reads them back. U+200B joins the rejected characters of both files.
With the four arms removed, the unit tests now fail.
validate_arn_region_and_table parsed the ARN a second time and denied
the request when the parse failed. Its three callers run
validate_arn_shape_and_account first. That function denies the same
case itself, so the arm could not run. The same held for the "not a
DynamoDB resource arn" arm after the table name extraction. The first
half had already refused every resource that is not table/<name>.

validate_arn_shape_and_account now returns the parsed ArnFields, and
validate_arn_region_and_table takes them. extract_table_name_from_arn
becomes table_name_of, which reads the table name from the parsed
resource, with a unit test for a bare table and a stream. TagResource
and UntagResource keep their check order. The five wire rows that hold
the UntagResource key check before the region and table check still
fail when the two calls swap places.
…yte-4 case

The validation module re-exported validate_tag_key and
validate_tag_value, and no code outside tag.rs called them. They are now
private to the module. validate_tags, validate_tag_keys,
validate_tags_member and validate_folded_tag_prefix stay public.

The comment on the aws: prefix check and the name of its test said
"multi-byte first character". Three of the five test keys start with an
ASCII character. The case is a character that spans byte 4, which a
slice at that byte would split. Both now say so.
docs/dynamodb-limits.md listed the tag key and value lengths as not
enforced, in characters. Both rows now read Enforced, in UTF-16 code
units: 1 to 128 for a key and 0 to 256 for a value. Each names
validate_tags in crates/core/src/validation/tag.rs. In the coverage
table, the API-Level row moves from 1, 0, 3, 1 to 3, 0, 1, 1. The Total
row moves from 34, 2, 14, 13 to 36, 2, 12, 13, the column sums of the
rows above it. Item 8 of the unenforced limits and L-7 of
docs/technical-debt.md named the same limit, and both go.
The v1.1.0 heading said the three operations check tags as DynamoDB
does. DynamoDB also refuses an empty tag list, a duplicate key, a 51st
tag and a tag with no Key or Value. This release does not (#1237 to
#1241). The heading now says the operations check tag keys and values
against DynamoDB's rules, which is what the entry below it lists.

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

Items 2 to 6, 8, 9 and 12 from the earlier review are resolved at 857ffe5 on SQLite, PostgreSQL, MongoDB and Cassandra. Each request was sent twice to the service and to this head. One CreateTable order regresses from main (inline). It blocks the merge.

  • Key and value lengths in UTF-16 units: 64 U+20000 accepted and 65 refused, 128 é accepted and 129 refused, in TagResource, UntagResource and CreateTable. The stored tags list back as the service lists them on all four backends.
  • Unicode 14.0 to 17.0 letters: 23 code points refused by the service and by this head, 8 code points from 13.0 accepted by both.
  • Stream ARNs for another region, partition or service answer Invalid StreamArn. Another account's table ARN answers Access is denied on TagResource, UntagResource and ListTagsOfResource.
  • Item 8: arn:aws:s3:us-east-1:<account>:table/x with key k! answers The Tag Key provided is invalid, Key: k! on the service. The earlier review said AccessDeniedException. That was wrong, and the code is right.
  • Tags that 1.0.0 stored outside these rules still list, still drive aws:ResourceTag conditions, refuse UntagResource and TagResource by key, and clear on DeleteTable, on all four backends. The upgrade note describes this.
  • Each new test fails with its check removed. CI is green on 64 of 64 checks.

crates/engine/src/create_table.rs (above validate_folded_tag_prefix)

This CreateTable regresses from main:
BillingMode: PAY_PER_REQUEST, ProvisionedThroughput: {ReadCapacityUnits: 1, WriteCapacityUnits: 1}, Tags: [{"Key": "awſ:foo", "Value": "v"}]

  • Service and main: ValidationException: One or more parameter values were invalid: Neither ReadCapacityUnits nor WriteCapacityUnits can be specified when BillingMode is PAY_PER_REQUEST
  • This head, on all four backends: ValidationException: One or more parameter values were invalid

The service reports the U+017F prefix after the constraint checks (null members, enum values, index name length, throughput values and the billing mode rules, table class) and before the semantic checks (undefined attribute, two HASH keys, extra attribute definition, OnDemandThroughput range, StreamEnabled without a view type, existing table). With the check moved there, PROVISIONED with no throughput, throughput {0,0}, a GSI or LSI named g, SSEType BAD and TableClass BAD beside the same tag also answer as the service does.

crates/engine/src/tagging (validate_arn_shape_and_account)

Optional. With either resource-kind check removed, all 182 tagging tests pass. authz_resource.rs:575 answers index, export and import ARNs first. A unit test calling this function with an index ARN would hold the engine copy.

PR body

Optional. The body lists two unit tests in create_table.rs for deserialization failures as the wrong JSON type. One of them tests the missing TableName message.

…e U+017F prefix

DynamoDB in us-east-1 reports these CreateTable faults before the tag
key awſ:foo (U+017F), each request sent twice on 2026-11-24:

- throughput on an on-demand table
- PROVISIONED without throughput
- a throughput of 0
- a GSI or LSI named g
- a GSI throughput of 0 on a PROVISIONED table

main reports these faults. Before this change, CreateTable answered "One
or more parameter values were invalid" for each, because
handle_create_table ran validate_folded_tag_prefix before
validate_create_table. The service
reports the prefix before two HASH keys, a third key schema element and
an undefined or unused attribute definition. It also reports the prefix
before a GSI throughput on an on-demand table and before StreamEnabled
without a view type.

validate_create_table now runs the table name check and then two groups.
validate_create_table_constraints checks each index name, the table's
throughput against its billing mode and the throughput minimum of a
provisioned table's GSIs. validate_create_table_definition runs the
other checks in their old order. The index name check moves out of the
GSI and LSI key schema loops into the first group. handle_create_table
calls the two groups with the prefix check between them, so each check
runs once on this path. RestoreTableFromBackup still calls
validate_create_table. A restore takes its index names, key schemas and
attribute definitions from the backup. So the new order changes its
answer only when a stored definition fails a definition check and an
override fails a throughput check.

Without tags, CreateTable now reports these faults before the key schema
and attribute definition faults too. For the throughput the service does
the same. A PROVISIONED table without throughput and with an undefined
key attribute gets the throughput refusal (measured 2026-11-20, #1109).
For an index name, that order is not measured without a tag.

Six new rows of the CreateTable order table assert the full message.
They hold the on-demand throughput fault and five faults that come after
the prefix. ExtendDB words the other five faults in its own texts, on
main too (#1041, #1147, #904). Their rows assert HTTP 400,
ValidationException and that the prefix refusal did not answer.
create_table_error returns the refusal for those rows, and
assert_create_table_refused now checks the HTTP status too.
…_shape_and_account

The server's gate refuses an index, export or import ARN on TagResource
and UntagResource before the engine runs. So no wire test reaches the
engine's own two resource-kind checks, and with either one removed all
182 tag tests passed (review of 2026-11-24).

validate_arn_shape_and_account now takes the account ID and the region,
the two fields of the OperationContext it read. A unit test calls it
with an index ARN and with an export ARN and asserts each message. With
either check removed, the test fails.
@LeeroyHannigan

Copy link
Copy Markdown
Collaborator Author

c317c72 fixes the CreateTable order. validate_create_table now runs the table name check, then validate_create_table_constraints, then validate_create_table_definition. The first group checks each index name, the table's throughput against its billing mode and the throughput minimum of a provisioned table's GSIs. The second runs the other checks in their old order. handle_create_table runs validate_folded_tag_prefix between the two groups. RestoreTableFromBackup still calls validate_create_table.

I sent each of these to DynamoDB in us-east-1 twice on 2026-11-24, with the same answer both times. Each body is an on-demand table keyed on pk with Tags: [{"Key": "awſ:foo", "Value": "v"}], and the service created no table.

Beside the tag DynamoDB 857ffe5 64e802b
ProvisionedThroughput {1, 1} One or more parameter values were invalid: Neither ReadCapacityUnits nor WriteCapacityUnits can be specified when BillingMode is PAY_PER_REQUEST One or more parameter values were invalid the DynamoDB text
PROVISIONED, no throughput One or more parameter values were invalid: ReadCapacityUnits and WriteCapacityUnits must both be specified when BillingMode is PROVISIONED the prefix text No provisioned throughput specified for the table (#1041)
PROVISIONED, throughput {0, 0} 2 validation errors detected: Value '0' at 'provisionedThroughput.writeCapacityUnits' failed to satisfy constraint: Member must have value greater than or equal to 1, then the same for readCapacityUnits the prefix text One or more parameter values were invalid: ReadCapacityUnits and WriteCapacityUnits must both be greater than or equal to 1 for table (#1147)
GSI named g 1 validation error detected: Value 'g' at 'globalSecondaryIndexes.1.member.indexName' failed to satisfy constraint: Member must have length greater than or equal to 3 the prefix text 1 validation error detected: Value 'g' at 'indexName' failed to satisfy constraint: Member must have length greater than or equal to 3 and less than or equal to 255 (#904, #1137)
LSI named g the GSI text at localSecondaryIndexes.1.member.indexName the prefix text the same text as the GSI row
PROVISIONED, GSI throughput {0, 0} 2 validation errors detected, the two texts at globalSecondaryIndexes.1.member.provisionedThroughput the prefix text One or more parameter values were invalid: ReadCapacityUnits and WriteCapacityUnits must both be greater than or equal to 1 for index: gsi1 (#1147)
SSEType BAD 1 validation error detected: Value 'BAD' at 'sSESpecification.sSEType' failed to satisfy constraint: Member must satisfy enum value set: [AES256, KMS] the prefix text the prefix text (#1052, #1114)
TableClass BAD Invalid table-class parameter provided. Please try again with a valid table-class value: [STANDARD, STANDARD_INFREQUENT_ACCESS]. the prefix text the prefix text (#1052, #1114)
an undefined key attribute, two HASH keys, a third key schema element or an unused attribute definition One or more parameter values were invalid the same the same
a GSI throughput on an on-demand table, OnDemandThroughput {MaxReadRequestUnits: 0}, or StreamEnabled without a view type the same the same the same

ExtendDB has no SSEType or TableClass check on main, so main creates those two tables. #1114 adds both checks at the top of handle_create_table, ahead of the prefix check. The 64e802b texts are the ones main writes for these checks.

Run against 857ffe5, the two tag files fail 6 of their 193 tests: the throughput row and the five constraint rows of tests/test_tag_check_order.py. With the prefix check moved after both groups, the six rows for the faults after the prefix fail. All 193 pass at 64e802b on SQLite.

validate_arn_shape_and_account: 64e802b adds a unit test that sends an index ARN and an export ARN through it. With either resource-kind check removed, the test fails. The function now takes the account ID and the region.

Body: the two create_table.rs unit tests are now listed by what each holds, the type-fault predicate and the missing TableName sentence.

Main is at b0d1c64. It holds #1009 (3534c9e, the WebAssembly
build), which added zeroize, web-time and the wasm32 dependency
sections to crates/core/Cargo.toml. Four files conflicted:

- crates/core/Cargo.toml: the unicode-general-category entry of this
  branch stays after uuid, and main's entries follow it.
- SOFTWARE-LICENSE-NOTICES.html, SOFTWARE-LICENSE-NOTICES-MONGODB.html
  and SOFTWARE-LICENSE-NOTICES-DEV.html: generated again from the
  merged Cargo.lock, with SOFTWARE-LICENSE-NOTICES-CASSANDRA.html. The
  four notices checks pass.

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

The items from the earlier review are resolved at 64e802b. Each request was sent twice to the service in us-east-1 and to SQLite and PostgreSQL servers built from this head and from 857ffe5.

  • BillingMode: PAY_PER_REQUEST with ProvisionedThroughput {1, 1} and the tag awſ:foo answers One or more parameter values were invalid: Neither ReadCapacityUnits nor WriteCapacityUnits can be specified when BillingMode is PAY_PER_REQUEST, byte for byte as the service does. PROVISIONED with no throughput, throughput {0,0}, a GSI or LSI named g, a GSI named bad!name and a PROVISIONED GSI at {0,0} beside the same tag are reported ahead of the tag, and an undefined key attribute, two HASH keys, a PAY_PER_REQUEST GSI with throughput and StreamEnabled without a view type are reported after it, as on the service. SSEType and TableClass values of BAD still answer the tag sentence; ExtendDB has no check for those members yet (#1052), so the earlier review was wrong to list them here.
  • Eleven new rows hold the order. Moving the prefix check back to its 857ffe5 place fails 6 of 193, and moving each check of the first group after the prefix fails the rows for that check. The 26 CreateTable rows and the 5 refusal rows pass against the service twice.
  • The new validate_arn_shape_and_account test fails with either resource kind check removed, and the PR body now describes the two create_table.rs tests by what each holds.
  • A user without CreateTable permission still gets AccessDeniedException for each reordered fault, restores with bad overrides answer as on main on both restore paths, and UpdateTable index creation refuses g, bad! and {0,0} as before. 192 TagResource, UntagResource and ListTagsOfResource cases answer the same at 857ffe5 and here.
  • fmt, both clippy configurations and the 1.91.1 MSRV build are clean, the workspace tests pass apart from the host's secmem memlock test, and CI was green on 64 of 64 checks.

dd3d600 merges main and carries the same change as 64e802b apart from the license notices, and CI is green on its 65 checks.

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

v1 Needed for the 1.0 release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TagResource does not validate tag key and value characters

3 participants