summaryrefslogtreecommitdiff
path: root/src/mongo/rpc
diff options
context:
space:
mode:
authorYoonsoo Kim <yoonsoo.kim@mongodb.com>2021-08-03 20:57:29 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-04 02:20:56 +0000
commitbd221c2a5bfd2014bf1df08bb5497a5ee24650e2 (patch)
tree4ecff1b5d8e0c47341da65d53a36f7c1bcc46a90 /src/mongo/rpc
parent4e58f6ff438bcafbbeec99b1a739bba288b3295b (diff)
downloadmongo-bd221c2a5bfd2014bf1df08bb5497a5ee24650e2.tar.gz
SERVER-59069 Add buildinfo to allowlist for OP_QUERY commands
Diffstat (limited to 'src/mongo/rpc')
-rw-r--r--src/mongo/rpc/op_legacy_integration_test.cpp16
-rw-r--r--src/mongo/rpc/warn_deprecated_wire_ops.cpp2
2 files changed, 14 insertions, 4 deletions
diff --git a/src/mongo/rpc/op_legacy_integration_test.cpp b/src/mongo/rpc/op_legacy_integration_test.cpp
index a42232704ed..955c681ae68 100644
--- a/src/mongo/rpc/op_legacy_integration_test.cpp
+++ b/src/mongo/rpc/op_legacy_integration_test.cpp
@@ -395,6 +395,18 @@ void testAllowedCommand(const char* command, ErrorCodes::Error code = ErrorCodes
getDeprecatedOpCount(serverStatusReply, "query"));
}
+TEST(OpLegacy, IsSelfCommandViaOpQuery) {
+ testAllowedCommand("{_isSelf: 1}");
+}
+
+TEST(OpLegacy, BuildinfoCommandViaOpQuery) {
+ testAllowedCommand("{buildinfo: 1}");
+}
+
+TEST(OpLegacy, BuildInfoCommandViaOpQuery) {
+ testAllowedCommand("{buildInfo: 1}");
+}
+
TEST(OpLegacy, HelloCommandViaOpQuery) {
testAllowedCommand("{hello: 1}");
}
@@ -407,10 +419,6 @@ TEST(OpLegacy, IsmasterCommandViaOpQuery) {
testAllowedCommand("{ismaster: 1}");
}
-TEST(OpLegacy, IsSelfCommandViaOpQuery) {
- testAllowedCommand("{_isSelf: 1}");
-}
-
TEST(OpLegacy, SaslStartCommandViaOpQuery) {
// Here we verify that "saslStart" command passes parsing since the request is actually
// an invalid authentication request which is capture from a log. The AuthenticationFailed error
diff --git a/src/mongo/rpc/warn_deprecated_wire_ops.cpp b/src/mongo/rpc/warn_deprecated_wire_ops.cpp
index 64acf6dc601..0f3fd7597d2 100644
--- a/src/mongo/rpc/warn_deprecated_wire_ops.cpp
+++ b/src/mongo/rpc/warn_deprecated_wire_ops.cpp
@@ -114,6 +114,8 @@ void warnDeprecation(Client& client, StringData op) {
void checkAllowedOpQueryCommand(Client& client, StringData cmd) {
static constexpr std::array allowedOpQueryCommands{
"_isSelf"_sd,
+ "buildinfo"_sd,
+ "buildInfo"_sd,
"hello"_sd,
"isMaster"_sd,
"ismaster"_sd,