-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Shell
-
Server Programmability
There are tests that use the Mongo shell to imitate an internal client. For example, see the following:
... const testInternalClient = (function createInternalClient() { const connInternal = new Mongo(testDB.getMongo().host); const curDB = connInternal.getDB(dbName); assert.commandWorked(curDB.runCommand({ ["hello"]: 1, internalClient: {minWireVersion: NumberInt(0), maxWireVersion: NumberInt(7)} })); return connInternal; })(); ...
Currently, we rely on the global WireSpec to identify internal clients. This ticket should provide support for creating new shell connections that are considered to be originating form an internal client (i.e., by appending the internalClient field to the initial hello command).
For context, using Mongo to create a new database connection results in calling the following:
// "new Mongo(uri, encryptedDBClientCallback, {options...})" void MongoExternalInfo::construct(JSContext* cx, JS::CallArgs args) { ... auto cs = uassertStatusOK(MongoURI::parse(host)); ... std::unique_ptr<DBClientBase> conn( cs.connect(appname.value_or("MongoDB Shell"), errmsg, boost::none, &apiParameters)); ... }
Which calls into DBClientConnection::connect and initWireVersion . This internally uses the global WireSpec to decide if the initial hello command, sent to initiate the client/server handshake, should include the internalClient field:
...
if (auto wireSpec = WireSpec::instance().get(); wireSpec->isInternalClient) {
WireSpec::appendInternalClientWireVersion(wireSpec->outgoing, &bob);
}
...
However, WireSpec is a global construct that is initialized at startup, and we only consider connections originating from MongoD and MongoS to come from internal clients (e.g., see here).
- has to be done before
-
SERVER-56392 Don't allow clients to change the value of internalClient after the initial request
- Backlog