No validation on index name length on create_table request

Bug #1308528 reported by Andrii Ostapenko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MagnetoDB
Fix Released
Low
Nuno Santos

Bug Description

According to dynamodb we are expecting that index name length should be in range 3-255 symbols. However in magnetodb rest api we cat create table with index name length less than 3 and more than 255 characters:
Index name 2 char:
2014-04-16 12:54:25,951 Request: POST http://127.0.0.1:8480/v1/default_tenant/data/tables
2014-04-16 12:54:25,951 Request Headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2014-04-16 12:54:25,951 Request Body: {"local_secondary_indexes": [{"key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "last_posted_by"}], "index_name": "qq", "projection": {"projection_type": "ALL"}}], "key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "subject"}], "table_name": "testtempest1865335512", "attribute_definitions": [{"attribute_type": "S", "attribute_name": "forum"}, {"attribute_type": "S", "attribute_name": "subject"}, {"attribute_type": "S", "attribute_name": "last_posted_by"}]}
2014-04-16 12:54:27,349 Response Status: 200
2014-04-16 12:54:27,349 Response Headers: {'date': 'Wed, 16 Apr 2014 12:54:27 GMT', 'content-length': '940', 'content-type': 'application/json'}
2014-04-16 12:54:27,349 Response Body: {"table_description": {"key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "subject"}], "creation_date_time": 0, "links": [{"href": "http://127.0.0.1:8480/v1/default_tenant/data/tables/testtempest1865335512", "rel": "self"}, {"href": "http://127.0.0.1:8480/v1/default_tenant/data/tables/testtempest1865335512", "rel": "bookmark"}], "local_secondary_indexes": [{"index_size_bytes": 0, "key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "last_posted_by"}], "index_name": "qq", "projection": {"projection_type": "ALL"}, "item_count": 0}], "table_name": "testtempest1865335512", "table_size_bytes": 0, "table_status": "ACTIVE", "attribute_definitions": [{"attribute_type": "S", "attribute_name": "last_posted_by"}, {"attribute_type": "S", "attribute_name": "forum"}, {"attribute_type": "S", "attribute_name": "subject"}], "item_count": 0}}

Index name 256 char:
2014-04-16 13:00:26,935 Request: POST http://127.0.0.1:8480/v1/default_tenant/data/tables
2014-04-16 13:00:26,936 Request Headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2014-04-16 13:00:26,936 Request Body: {"local_secondary_indexes": [{"key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "last_posted_by"}], "index_name": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", "projection": {"projection_type": "ALL"}}], "key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "subject"}], "table_name": "testtempest1236299970", "attribute_definitions": [{"attribute_type": "S", "attribute_name": "forum"}, {"attribute_type": "S", "attribute_name": "subject"}, {"attribute_type": "S", "attribute_name": "last_posted_by"}]}
2014-04-16 13:00:28,169 Response Status: 200
2014-04-16 13:00:28,169 Response Headers: {'date': 'Wed, 16 Apr 2014 13:00:28 GMT', 'content-length': '1194', 'content-type': 'application/json'}
2014-04-16 13:00:28,169 Response Body: {"table_description": {"key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "subject"}], "creation_date_time": 0, "links": [{"href": "http://127.0.0.1:8480/v1/default_tenant/data/tables/testtempest1236299970", "rel": "self"}, {"href": "http://127.0.0.1:8480/v1/default_tenant/data/tables/testtempest1236299970", "rel": "bookmark"}], "local_secondary_indexes": [{"index_size_bytes": 0, "key_schema": [{"key_type": "HASH", "attribute_name": "forum"}, {"key_type": "RANGE", "attribute_name": "last_posted_by"}], "index_name": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", "projection": {"projection_type": "ALL"}, "item_count": 0}], "table_name": "testtempest1236299970", "table_size_bytes": 0, "table_status": "ACTIVE", "attribute_definitions": [{"attribute_type": "S", "attribute_name": "last_posted_by"}, {"attribute_type": "S", "attribute_name": "forum"}, {"attribute_type": "S", "attribute_name": "subject"}], "item_count": 0}}

Changed in magnetodb:
importance: Undecided → Low
milestone: none → 2.0.4
tags: added: data-api
tags: added: validation
Changed in magnetodb:
milestone: 2.0.4 → next
Revision history for this message
Charles Wang (charles-wang) wrote :

Table name has the same limit of 3-255 chars. Please be sure to validate it as well.

Revision history for this message
Nuno Santos (nunosantos) wrote :
Changed in magnetodb:
assignee: nobody → Nuno Santos (nunosantos)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on magnetodb (master)

Change abandoned by Nuno Santos (<email address hidden>) on branch: master
Review: https://review.openstack.org/125445

Changed in magnetodb:
milestone: next → kilo-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to magnetodb (master)

Reviewed: https://review.openstack.org/125445
Committed: https://git.openstack.org/cgit/stackforge/magnetodb/commit/?id=2e2125b409a31c30f1edd4c70c3aa3c60c617006
Submitter: Jenkins
Branch: master

commit 2e2125b409a31c30f1edd4c70c3aa3c60c617006
Author: Nuno Santos <email address hidden>
Date: Tue Oct 28 15:41:57 2014 -0400

    Additional validation; UUIDs as internal table names

    Restrict keyspace, index, table, and attribute names to valid characters,
    and minimum and maximum lengths as per
    http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html

    Use UUIDs as internal table / column family names in Cassandra
    implementation, to deal with different length limits and valid characters.

    Closes-Bug: #1308528
    Closes-Bug: #1271576
    Closes-Bug: #1298588
    Closes-Bug: #1298633

    Implements blueprint cassandra-uuid-internal-names

    Change-Id: I47ea3dd15c6bf4b4946f626734f4d6e45375a48b

Changed in magnetodb:
status: In Progress → Fix Committed
Changed in magnetodb:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.