0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

SECURITY-330 redact password from CmdSaslStart

This commit is contained in:
Merry Mou 2015-08-19 17:43:06 -04:00
parent f8cdaf32b6
commit d3cce3d105

View File

@ -34,6 +34,8 @@
#include "mongo/base/init.h"
#include "mongo/base/status.h"
#include "mongo/base/string_data.h"
#include "mongo/bson/mutable/algorithm.h"
#include "mongo/bson/mutable/document.h"
#include "mongo/bson/util/bson_extract.h"
#include "mongo/client/sasl_client_authenticate.h"
#include "mongo/db/audit.h"
@ -69,6 +71,8 @@ public:
const BSONObj&,
std::vector<Privilege>*) {}
void redactForLogging(mutablebson::Document* cmdObj) override;
virtual bool run(OperationContext* txn,
const std::string& db,
BSONObj& cmdObj,
@ -266,6 +270,13 @@ void CmdSaslStart::help(std::stringstream& os) const {
os << "First step in a SASL authentication conversation.";
}
void CmdSaslStart::redactForLogging(mutablebson::Document* cmdObj) {
mutablebson::Element element = mutablebson::findFirstChildNamed(cmdObj->root(), "payload");
if (element.ok()) {
element.setValueString("xxx");
}
}
bool CmdSaslStart::run(OperationContext* txn,
const std::string& db,
BSONObj& cmdObj,