diff options
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/initialize_api_parameters.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/initialize_api_parameters.cpp b/src/mongo/db/initialize_api_parameters.cpp index 1c4ec3c1009..d480e3acf2b 100644 --- a/src/mongo/db/initialize_api_parameters.cpp +++ b/src/mongo/db/initialize_api_parameters.cpp @@ -75,6 +75,14 @@ const APIParametersFromClient initializeAPIParameters(const BSONObj& requestBody str::stream() << "Provided apiStrict:true, but the command " << command->getName() << " is not in API Version " << apiVersionFromClient, strictAssert); + bool strictDoesntWriteToSystemJS = + !(command->getReadWriteType() == BasicCommand::ReadWriteType::kWrite && + requestBody.firstElementType() == BSONType::String && + requestBody.firstElement().String() == "system.js"); + uassert(ErrorCodes::APIStrictError, + str::stream() << "Provided apiStrict:true, but the command " << command->getName() + << " attempts to write to system.js", + strictDoesntWriteToSystemJS); } if (apiParamsFromClient.getApiDeprecationErrors().get_value_or(false)) { |