From d332f0aef8831ca112ab55a958d20d9ca94d18cd Mon Sep 17 00:00:00 2001 From: "through.a.haze" Date: Fri, 16 Oct 2020 22:30:06 +0300 Subject: [PATCH] fix: correctly extend the "command" object with "user" I believe there should be `Object.assign` and not `Object.apply` otherwise `user` isn't added to the `command` object and authentication that requires this field fails. --- lib/core/auth/x509.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/auth/x509.js b/lib/core/auth/x509.js index 57a5c55009..4dafa3c6ce 100644 --- a/lib/core/auth/x509.js +++ b/lib/core/auth/x509.js @@ -26,7 +26,7 @@ class X509 extends AuthProvider { function x509AuthenticateCommand(credentials) { const command = { authenticate: 1, mechanism: 'MONGODB-X509' }; if (credentials.username) { - Object.apply(command, { user: credentials.username }); + Object.assign(command, { user: credentials.username }); } return command;