Skip to content

In-memory DynamoDB accepts empty query keys, start keys outside the key condition, and oversized items #93

Closed

Description

@fctl-sh

Priority: medium. Requests DynamoDB refuses that the in-memory backend accepts, so tests pass and production fails:

  • Empty key values in KeyConditionExpression (backend/memory/query.rs, expr/mod.rs check_key_type checks the type only): pk = :p with :p = "" returns nothing instead of ValidationException: ... The AttributeValue for a key attribute cannot contain an empty string value. Key: pk (reported against AWS in Dynamodb query with a KeyConditionExpression should raise ClientError when the partition key is empty getmoto/moto#7062); also for sort keys and B index keys.
  • ExclusiveStartKey checks (query.rs): index start keys are not type-checked and extra attributes are not refused (a GSI start key with a number for a string key silently restarts at the first item); start keys outside the key condition are accepted (a start key in another partition returns [], one below a sk >= 3 bound continues), where DynamoDB answers "The provided starting key is outside query boundaries based on provided conditions" (per Erroneous DynamoDB SDK Validation Exception on a Query with a start key and a key condition with 'greater than or equals to' aws/aws-sdk-ruby#2456; not verified here).
  • Size limits (table.rs, transact.rs): the 400 KB item limit ignores local index entries ("For each local secondary index on a table, there is a 400 KB limit on the total of" the item and its entries); secondary index key values are never size-checked (a 3000-byte GSI partition key is accepted, against 2048 / 1024 bytes); TransactGetItems has no 4 MB check and TransactWriteItems counts only Put items towards it (eleven 390 KB updates are accepted).

Found in a review of the library for bugs (fctl session); the fixes that fit in its ten pull requests are #61 to #65, #67 to #70 and #72.

Activity

  1. added
    bug
    rust
    on Oct 30, 2026
  2. fctl-sh commented on Oct 31, 2026

    @fctl-sh
    ContributorAuthor

    Most of this issue is handled in #133: empty key values in key conditions, start keys of queries and index scans (shape, types, and the key condition, with the messages dynoxide-rs captured against DynamoDB), size limits of secondary index key values, and updates counting towards the 4 MB limit of TransactWriteItems.

    Two parts are left, because no source I could check gives DynamoDB's answer, and the sandbox has no AWS credentials to measure it:

    • Local index entries in the 400 KB item limit. DynamoDB documents that "for each local secondary index on a table, there is a 400 KB limit on the total of" the item and its index entries, but neither its docs, moto nor dynoxide-rs say which error a write over it gets (presumably ValidationException: Item size has exceeded the maximum allowed size, or ItemCollectionSizeLimitExceededException).
    • A 4 MB limit for TransactGetItems. The docs give the limit for the aggregate size of the items read, but not the error. dynoxide-rs does not model it.

    To settle them, on a table with a local index that projects ALL: put an item of about 300 KB (the write should be refused), and run a TransactGetItems of eleven 390 KB items. Then model the answers in the memory backend (table.rs validate_item, transact.rs transact_get_items).

  3. added 2 commits that reference this issue on Oct 31, 2026
    9c3cc19
    6f7b82e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugrust

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions