[SERVER-75942] Check that database name is valid UTF-8 when creating a new database Created: 11/Apr/23 Updated: 30/Jan/24 |
|
| Status: | Open |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Adi Agrawal | Assignee: | Backlog - Query Execution |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Assigned Teams: |
Query Execution
|
||||||||||||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||||||||||||||||||||||||||||||||
| Operating System: | ALL | ||||||||||||||||||||||||||||||||||||||||||||
| Steps To Reproduce: | 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 |
||||||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||||||
| Description |
ObjectiveHave 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 Original DescriptionWhen running the attached bad_dbname.cpp 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 |
| Comments |
| Comment by Kyle Suarez [ 09/Jun/23 ] |
|
cailin.nelson@mongodb.com, I've updated the description. Adding this to the next query execution quick win bucket. |
| Comment by Xiaochen Wu [ 06/Jun/23 ] |
|
Considering |