-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
Minor Change
-
ALL
-
-
QE 2024-09-16, QE 2024-09-30, QE 2024-10-14, QE 2024-10-28, QE 2024-11-11
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). All collection names should be checked during upgrade too. The function that validates UTF-8 sequences should be updated to catch all illegal sequences.
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.
- is depended on by
-
TOOLS-3286 Investigate changes in SERVER-75942: Check that database name is valid UTF-8 when creating a new database
- Waiting (Blocked)
- is duplicated by
-
SERVER-76793 Warn when database names are invalid UTF-8
- Closed
- is related to
-
SERVER-96319 Not all invalid UTF-8 sequences are detected in std::validUTF8 function
- Closed
- related to
-
SERVER-95394 Need significant changes to validUTF8 and escape functions
- Open
-
SERVER-80788 Prevent creation of databases with names containing disallowed characters
- Backlog
-
SERVER-93732 The server should reject inserting/updating strings containing invalid UTF-8
- Needs Scheduling
-
SERVER-76793 Warn when database names are invalid UTF-8
- Closed
-
SERVER-75659 Investigate why config.databases collection contain entries with invalid names
- Closed
-
SERVER-57026 Regular expression is invalid UTF-8 while enabling mongo backwards-incompatible 4.0 features
- Closed