[SERVER-48631] renameCollection permits creation of a collection which begins with "." Created: 05/Jun/20  Updated: 29/Oct/23  Resolved: 13/Jul/20

Status: Closed
Project: Core Server
Component/s: Catalog
Affects Version/s: None
Fix Version/s: 4.7.0

Type: Bug Priority: Major - P3
Reporter: Charlie Swanson Assignee: Katherine Wu (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:
Linked BF Score: 9

 Description   

> db.foo.insert({x: 1})
WriteResult({ "nInserted" : 1 })
> db.foo.renameCollection(".")
{ "ok" : 1 }
> db.listCollections()
uncaught exception: TypeError: db.listCollections is not a function :
@(shell):1:1
> show tables
.
bug
> db[".foo"].insert({x: 1})
WriteCommandError({
	"ok" : 0,
	"errmsg" : "Collection names cannot start with '.'",
	"code" : 73,
	"codeName" : "InvalidNamespace"
})

It seems like we're just missing some validation on the target namespace.



 Comments   
Comment by Githook User [ 10/Jul/20 ]

Author:

{'name': 'Katherine Wu', 'email': 'katherine.wu@mongodb.com', 'username': 'kaywux'}

Message: SERVER-48631 Do not allow renameCollection to create collection which begins with '.'
Branch: master
https://github.com/mongodb/mongo/commit/6c0ac0678f3c159c65c497acf155e964dec43f61

Generated at Thu Feb 08 05:17:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.