Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-75942

Check that database name is valid UTF-8 when creating a new database

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Execution
    • Minor Change
    • ALL
    • Hide

      Add bad_dbname.cpp to SConscript (in db_integration_test lib)

      Compile

      Run buildscripts/resmoke.py run --suite=integration_tests_sharded ./build/install/bin/db_integration_test

      Show
      Add bad_dbname.cpp to SConscript (in db_integration_test lib) Compile Run buildscripts/resmoke.py run --suite=integration_tests_sharded ./build/install/bin/db_integration_test

      Objective

      Have the server validate database names and prohibit invalid UTF-8 when creating a new database. In addition, add a special internal setParameter that disables this validation, so that a mongorestore/mongosync that must preserve these bad names has an escape valve to do so. Also, check if the name is valid during upgrade and block upgrade if the name is invalid (see comment on SERVER-76793).

      Original Description

      When running the attached bad_dbname.cppscript with mongod, we allow the database name to have an invalid utf-8 character (eg. "name\xbc").

      When running with mongos, the sharding catalog manager checks if the dbName already exists. It also does a case insensitive match by filtering on the regex (https://github.com/10gen/mongo/blob/master/src/mongo/db/s/config/sharding_catalog_manager_database_operations.cpp/#L176-L180). In doing so, the regex fails with invalid utf-8 (https://github.com/10gen/mongo/blob/master/src/mongo/db/matcher/expression_leaf.cpp/#L245-L247).

      We should not allow creating a database with an invalid utf-8 in any of the cases.

      This was motivated by investigating  SERVER-57026 and HELP-43395. We should verify that after this change the invalid entries listed in the tickets cannot be created.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            adi.agrawal@mongodb.com Adi Agrawal
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: