Repository navigation
Description
Observed on the service
Measured against DynamoDB (us-east-1) on 2026-10-25 at 11:31 and 12:56 UTC on tables with pk S and sk N, each read request sent twice.
PutItemwithsk: {"N": "\uff11"}(fullwidth one) anda: {"N": "\u0661\u0662"}(Arabic-Indic one and two) is accepted.GetItemon that item by the fullwidth key and by the ASCII key{"N": "1"}both return the item, and the item readssk: {"N": "1"},a: {"N": "12"}: the service stores the ASCII value.GetItemon an item written withsk: {"N": "1"}by the fullwidth key{"N": "\uff11"}returns the item.Querywithsk = :nwhere:nis a fullwidth, Arabic-Indic or Devanagari one returns the item stored withskN1; aFilterExpressiona = :fwith the same digits matches an attribute stored as1.Querywith anExclusiveStartKeywhoseskis a fullwidth zero returns the item stored withskN1, and with a fullwidth one (the item itself) returns nothing after it. AScanwith anExclusiveStartKeywritten with a fullwidth one is accepted.{"N": "bob"}in the same position answersThe parameter cannot be converted to a numeric value: bobon both.- Thirty nine Devanagari ones answer
Attempting to store more than 38 significant digits in a Number, so the digits are parsed and counted as digits. - A superscript two (
\u00b2), a vulgar half (\u00bd), a fullwidth minus (\uff0d1) and a fullwidth full stop (1\uff0e5) are refused withThe parameter cannot be converted to a numeric value: <value as sent>.
The accepted characters are those of Unicode general category Nd (decimal digit); the refused ones are categories No, Pd and Po. The service reads the digits as their ASCII value when it stores or compares a number.
Observed on ExtendDB
On main:
PutItemwithsk: {"N": "\uff11"}, or witha: {"N": "\uff11"}:ValidationException: The parameter cannot be converted to a numeric value: 1.UpdateItemwithSET b = :v,:v = {"N": "\uff11"}:ValidationException: ExpressionAttributeValues contains invalid value: The parameter cannot be converted to a numeric value: 1 for key :v.GetItemwithKey: {pk: {"S": "a"}, sk: {"N": "\uff11"}}on a table whose sort key is N:InternalServerError. The key values ofGetItem,BatchGetItem,TransactGetItemsandExclusiveStartKeydo not run the number validator, and the storage layer fails to parse the value.QueryandScanwith anExclusiveStartKeywritten with a fullwidth digit on an N sort key:InternalServerErroron SQLite and PostgreSQL.QueryandScancompare a key condition or filter value written with a Unicode digit as the text the request sent, so it matches no item stored with the ASCII digit. A numeric sort key condition written that way answersInternalServerErroron SQLite.
The write paths refuse because the number validator in crates/core/src/validation/number.rs accepts ASCII digits only. That validator runs on PutItem, UpdateItem, BatchWriteItem, TransactWriteItems and the condition expression values of DeleteItem.
Proposed change
Read a Unicode decimal digit as its ASCII value wherever a number is parsed, so writes store the ASCII value and reads compare it, as the service does. The fold table (the 68 run zeros of Unicode 15.0, each run ten consecutive code points) is in crates/engine/src/decimal_digits.rs once the Query number check lands, and can move to crates/core.
The value has to be read the same way by every consumer of a request. In particular, the server binds dynamodb:LeadingKeys from the partition key value of a Query, GetItem or write before the engine runs; if the engine reads a Unicode digit as a number and the binding does not, the two see different partitions. Folding the digits once, in the request body before authorization, gives both the same value.
Tests: GetItem, Query and Scan by a Unicode-digit key and ExclusiveStartKey, PutItem and UpdateItem with such a value read back as ASCII, and a dynamodb:LeadingKeys condition evaluated on the folded value.
Activity
LeeroyHannigan commentedon Nov 1, 2026
PutItem on an N hash key and Scan with an
ExclusiveStartKeyon that key, measured against Amazon DynamoDB in us-east-1 on 31 October 2026, each request twice, both answers identical. TablepkN HASH (no sort key), itemspk1 to 6.PutItem on the hash key:
Itemf49c5f823(SQLite, release build){"pk": {"N": "\uff19"}}(fullwidth nine)pk9ValidationException: The parameter cannot be converted to a numeric value: 9{"pk": {"N": "\u0667"}}(Arabic-Indic seven)7٧{"pk": {"N": "\uff11\uff12.\uff15"}}(fullwidth digits around an ASCII full stop)12.512.5The table holds 1 to 6 after the three refusals. The 25 October rows had the sort key and a non-key attribute; this adds the hash key and a decimal written with mixed digits (25 October measured the fullwidth full stop as refused; 31 October measured an ASCII full stop between fullwidth digits as read).
Scan with an
ExclusiveStartKeyon the hash key:ExclusiveStartKeyf49c5f823{"pk": {"N": "\uff11"}}1in the table's orderLastEvaluatedKey{"pk": {"N": "\u0661"}}{"pk": {"N": "+1"}}1So on a hash key the key is accepted and the scan answers an empty page where the 25 October rows on an N sort key answered
InternalServerErroron SQLite and PostgreSQL. A client paging with such a key reads the table as finished after1. On the same server, Querypk = :pwithFilterExpressiona = :nand:n={"N": "\uff11"}answers Count 0 on an item whoseais1, as the issue describes.Code on main:
validate_and_normalize_number(crates/core/src/validation/number.rs, lines 30 and 47) accepts ASCII digits only, which refuses the three PutItem rows. The ScanExclusiveStartKeypassescheck_exclusive_start_key(crates/engine/src/index_helpers.rs), which compares the descriptor with the declared type and never reads the number, so the key reaches the storage layer as sent. The fix for #564 adds a number check on Scan'sExclusiveStartKeythat reads these digits as numbers for the check; with it, the two keys above still answer 200 with no items.docs: list three Query differences from DynamoDB
LeeroyHannigan commentedon Nov 24, 2026
More rows for a Query key value, measured in us-east-1 on 2026-11-24 for #481. Each request went out twice and got the same answer both times. Every request named a table that does not exist, so these answers come before the table lookup. The expression form is
n = :vinKeyConditionExpression, and the legacy form isnwithEQinKeyConditions.ResourceNotFoundException(read as the number 1)Attempting to store more than 38 significant digits in a NumberOn #481's branch a value with a character outside ASCII is still sized as 0 bytes and passed on, as main does. On a SQLite server the Query then answers HTTP 200 with Count 0, or
InternalServerErroron an N sort key. tests/python holds no expected failures, so #481 keeps no wire row for these values. A fix here makes the 39, 683, 700 and 2049 rows answer the 38-digit sentence in both forms, and keeps one U+FF11 served.fix(core): refuse a Query key N value that is not a number
test(query): pin the number sentences in each Query key position
test(query): leave the U+FF11 rows to #565
fix(query): let a legacy number with a Unicode digit reach the table …
demohan commentedon Nov 25, 2026
Two more shapes for this issue, from a Query on an N key (the GSI expression, the GSI
KeyConditions, the base N partition key and the base N sort key), each sent twice to the service in us-east-1 and to SQLite builds of #481's head (ee58827) and of main 3534c9e::v(N)KeyConditions, base HASH1The parameter cannot be converted to a numeric value:followed by U+00A01InternalServerErroraThe parameter cannot be converted to a numeric value: 1aInternalServerErrorThe service echoes U+FF11 then
aas1a, so it folds the digit before it reports the value. A no-break space is not read as a digit and is echoed as sent. The same table holds for 683, 700, 682 and 39 U+FF11, which the service answers withAttempting to store more than 38 significant digits in a Number.LeeroyHannigan commentedon Nov 25, 2026
More shapes for this issue, from demohan's review of #507 at
bfbf7e373(#507 (comment)). On a table that exists, a legacyScanFilter,QueryFilterorKeyConditionsvalue with U+FF11 or U+0661 reaches the storage layer as written. demohan counted 32 shapes:ScanFilter,QueryFilterand a GSI key condition: ExtendDB answers 200 with Count 0. demohan measured that the service returns the item.KeyConditionson anNsort key, withsk EQ,sk BETWEENandsk BETWEEN [1E2, 5]: ExtendDB answers 500InternalServerError.Main answers these as
bfbf7e373does. #507's earlier head72b53241refused them with the number text, which was also wrong. #507 leaves them to this issue. Its check now passes these digits, as the service does, and the read stays as on main.I ran the same groups again on a SQLite server of #507 at
08562698d. The table haspkS,skN and a GSI onnN, and holds one item withsk,nandaset to1. I sent each body twice and got the same answer both times:ScanFilteraEQ the digitKeyConditionspkEQ,QueryFilteraEQ the digitKeyConditionsnEQ the digitKeyConditionspkEQ,skEQ the digitKeyConditionspkEQ,skBETWEEN the digit and5KeyConditionspkEQ,skBETWEEN the digit withE2and5A SQLite server of
96713261a, which isbfbf7e373with main merged in, gives the same answers.fix(query): pass a non-ASCII legacy number only for Unicode decimal d…
LeeroyHannigan commentedon Nov 25, 2026
One more shape for this issue, from demohan's review of #544 (#544 (comment)). The body is a
Querywith{"NS": ["1", "1"], "S": "x"}as:zinExpressionAttributeValues: a fullwidth one (U+FF11) and an ASCII one, beside anS.ExpressionAttributeValues contains invalid value: Input collection contains duplicates for key :zExpressionAttributeValues contains invalid value: Supplied AttributeValue has more than one datatypes set, must contain exactly one of the supported datatypes for key :zThe body went twice to the service on 2026-11-25 at 06:23 UTC, with a table name that does not exist. It also went twice to the SQLite server. Each gave the same answer both times. I built the server from a commit on 31c5f3d that changes only comments and tests.
The service reads
1as1, so the set holds the number 1 twice. On main, the number check folds the digit and accepts both members. The duplicate check,has_equal_numbersincrates/core/src/validation/number.rs, compares1as written and finds no duplicate. So the value gets the more than one datatypes text. A fix for this issue needs to fold the digits in that duplicate check too.fix(query): check Query values against the key schema and the number …
fix(query): refuse key condition values over the key size limits (Ext…