[SERVER-12591] renameCollection allows renaming to system collections Created: 03/Feb/14  Updated: 28/Oct/15  Resolved: 06/Feb/14

Status: Closed
Project: Core Server
Component/s: Admin
Affects Version/s: None
Fix Version/s: 2.6.0-rc0

Type: Bug Priority: Major - P3
Reporter: Mathias Stearn Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-12586 $out shouldn't be able to write to sy... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 Description   

This bypasses the error when users try to insert into system namespaces:

> db.system.foo.insert({})
2014-02-03T16:09:53.434-0500 batch failed, cannot aggregate results: cannot write to 'test.system.foo' at src/mongo/shell/batch_api.js:612
 
> db.system___foo.insert({})
SingleWriteResult({
        "writeErrors" : [ ],
        "writeConcernErrors" : [ ],
        "nInserted" : 1,
        "nUpserted" : 0,
        "nUpdated" : 0,
        "nModified" : 0,
        "nRemoved" : 0,
        "upserted" : [ ]
})
> db.system___foo.renameCollection('system.foo')
{ "ok" : 1 }
> db.system.foo.find()
{ "_id" : ObjectId("52f005ae6d0abd019aead824") }



 Comments   
Comment by Mathias Stearn [ 06/Feb/14 ]

Rename now uses the same checks as insert. That means that some system collections are whitelisted, but users can't make up their own system collections.

Comment by Githook User [ 05/Feb/14 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-12591 renameCollection now checks that source and target namespaces are valid for user writes
Branch: master
https://github.com/mongodb/mongo/commit/f6e6601bcf44b9d753c71bf3fdc211ecabbe160f

Generated at Thu Feb 08 03:28:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.