summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/initialize_api_parameters.cpp8
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)) {