mongodb 3.7.3 → 3.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/auth/scram.js +2 -2
- package/lib/core/error.js +6 -1
- package/lib/core/sessions.js +2 -1
- package/package.json +1 -1
package/lib/core/auth/scram.js
CHANGED
|
@@ -25,7 +25,7 @@ class ScramSHA extends AuthProvider {
|
|
|
25
25
|
|
|
26
26
|
prepare(handshakeDoc, authContext, callback) {
|
|
27
27
|
const cryptoMethod = this.cryptoMethod;
|
|
28
|
-
if (cryptoMethod === 'sha256' && saslprep
|
|
28
|
+
if (cryptoMethod === 'sha256' && typeof saslprep !== 'function') {
|
|
29
29
|
emitWarningOnce('Warning: no saslprep library specified. Passwords will not be sanitized');
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -125,7 +125,7 @@ function continueScramConversation(cryptoMethod, response, authContext, callback
|
|
|
125
125
|
|
|
126
126
|
let processedPassword;
|
|
127
127
|
if (cryptoMethod === 'sha256') {
|
|
128
|
-
processedPassword = saslprep ? saslprep(password) : password;
|
|
128
|
+
processedPassword = typeof saslprep === 'function' ? saslprep(password) : password;
|
|
129
129
|
} else {
|
|
130
130
|
try {
|
|
131
131
|
processedPassword = passwordDigest(username, password);
|
package/lib/core/error.js
CHANGED
|
@@ -246,6 +246,10 @@ const RETRYABLE_WRITE_ERROR_CODES = new Set([
|
|
|
246
246
|
MONGODB_ERROR_CODES.ExceededTimeLimit
|
|
247
247
|
]);
|
|
248
248
|
|
|
249
|
+
function isRetryableEndTransactionError(error) {
|
|
250
|
+
return error.hasErrorLabel('RetryableWriteError');
|
|
251
|
+
}
|
|
252
|
+
|
|
249
253
|
function isRetryableWriteError(error) {
|
|
250
254
|
if (error instanceof MongoWriteConcernError) {
|
|
251
255
|
return (
|
|
@@ -347,5 +351,6 @@ module.exports = {
|
|
|
347
351
|
isSDAMUnrecoverableError,
|
|
348
352
|
isNodeShuttingDownError,
|
|
349
353
|
isRetryableWriteError,
|
|
350
|
-
isNetworkErrorBeforeHandshake
|
|
354
|
+
isNetworkErrorBeforeHandshake,
|
|
355
|
+
isRetryableEndTransactionError
|
|
351
356
|
};
|
package/lib/core/sessions.js
CHANGED
|
@@ -7,6 +7,7 @@ const Binary = BSON.Binary;
|
|
|
7
7
|
const uuidV4 = require('./utils').uuidV4;
|
|
8
8
|
const MongoError = require('./error').MongoError;
|
|
9
9
|
const isRetryableError = require('././error').isRetryableError;
|
|
10
|
+
const isRetryableEndTransactionError = require('././error').isRetryableEndTransactionError;
|
|
10
11
|
const MongoNetworkError = require('./error').MongoNetworkError;
|
|
11
12
|
const MongoWriteConcernError = require('./error').MongoWriteConcernError;
|
|
12
13
|
const Transaction = require('./transactions').Transaction;
|
|
@@ -511,7 +512,7 @@ function endTransaction(session, commandName, callback) {
|
|
|
511
512
|
|
|
512
513
|
// send the command
|
|
513
514
|
session.topology.command('admin.$cmd', command, { session }, (err, reply) => {
|
|
514
|
-
if (err &&
|
|
515
|
+
if (err && isRetryableEndTransactionError(err)) {
|
|
515
516
|
// SPEC-1185: apply majority write concern when retrying commitTransaction
|
|
516
517
|
if (command.commitTransaction) {
|
|
517
518
|
// per txns spec, must unpin session in this case
|