You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

mongodb-core

Package Overview
Dependencies
Maintainers
3
Versions
177
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.7 to 3.1.8

11

HISTORY.md

@@ -5,2 +5,13 @@ # Change Log

<a name="3.1.8"></a>
## [3.1.8](https://github.com/mongodb-js/mongodb-core/compare/v3.1.7...v3.1.8) (2018-11-05)
### Bug Fixes
* **sspi:** correct auth process for SSPI ([808ab21](https://github.com/mongodb-js/mongodb-core/commit/808ab21))
* **uri_parser:** add `replSet` to exemption list for number coercion ([d00b1ab](https://github.com/mongodb-js/mongodb-core/commit/d00b1ab))
<a name="3.1.7"></a>

@@ -7,0 +18,0 @@ ## [3.1.7](https://github.com/mongodb-js/mongodb-core/compare/v3.1.6...v3.1.7) (2018-10-10)

14

lib/auth/gssapi.js
'use strict';
const f = require('util').format;
const Kerberos = require('../utils').Kerberos;
const MongoAuthProcess = require('../utils').MongoAuthProcess;
const Query = require('../connection/commands').Query;
const MongoError = require('../error').MongoError;
const retrieveKerberos = require('../utils').retrieveKerberos;

@@ -47,4 +46,9 @@ var AuthSession = function(db, username, password, options) {

var self = this;
// We don't have the Kerberos library
if (Kerberos == null) return callback(new Error('Kerberos library is not installed'));
let kerberos;
try {
kerberos = retrieveKerberos();
} catch (e) {
return callback(e, null);
}
// TODO: remove this once we fix URI parsing

@@ -67,2 +71,3 @@ var gssapiServiceName = options['gssapiservicename'] || options['gssapiServiceName'] || 'mongodb';

self,
kerberos.processes.MongoAuthProcess,
db,

@@ -120,2 +125,3 @@ username,

self,
MongoAuthProcess,
db,

@@ -122,0 +128,0 @@ username,

'use strict';
const f = require('util').format;
const Kerberos = require('../utils').Kerberos;
const MongoAuthProcess = require('../utils').MongoAuthProcess;
const Query = require('../connection/commands').Query;
const MongoError = require('../error').MongoError;
const retrieveKerberos = require('../utils').retrieveKerberos;

@@ -47,4 +46,9 @@ var AuthSession = function(db, username, password, options) {

var self = this;
// We don't have the Kerberos library
if (Kerberos == null) return callback(new Error('Kerberos library is not installed'));
let kerberos;
try {
kerberos = retrieveKerberos();
} catch (e) {
return callback(e, null);
}
var gssapiServiceName = options['gssapiServiceName'] || 'mongodb';

@@ -66,2 +70,3 @@ // Total connections

self,
kerberos.processes.MongoAuthProcess,
username,

@@ -113,4 +118,5 @@ password,

var SSIPAuthenticate = function(
function SSIPAuthenticate(
self,
MongoAuthProcess,
username,

@@ -124,12 +130,3 @@ password,

) {
// Build Authentication command to send to MongoDB
var command = {
saslStart: 1,
mechanism: 'GSSAPI',
payload: '',
autoAuthorize: 1
};
// Create authenticator
var mongo_auth_process = new MongoAuthProcess(
const authProcess = new MongoAuthProcess(
connection.host,

@@ -141,92 +138,63 @@ connection.port,

// Execute first sasl step
server(
connection,
new Query(self.bson, '$external.$cmd', command, {
function authCommand(command, authCb) {
const query = new Query(self.bson, '$external.$cmd', command, {
numberToSkip: 0,
numberToReturn: 1
}),
function(err, r) {
});
server(connection, query, authCb);
}
authProcess.init(username, password, err => {
if (err) return callback(err, false);
authProcess.transition('', (err, payload) => {
if (err) return callback(err, false);
var doc = r.result;
mongo_auth_process.init(username, password, function(err) {
if (err) return callback(err);
const command = {
saslStart: 1,
mechanism: 'GSSAPI',
payload,
autoAuthorize: 1
};
mongo_auth_process.transition(doc.payload, function(err, payload) {
if (err) return callback(err);
authCommand(command, (err, result) => {
if (err) return callback(err, false);
const doc = result.result;
// Perform the next step against mongod
var command = {
authProcess.transition(doc.payload, (err, payload) => {
if (err) return callback(err, false);
const command = {
saslContinue: 1,
conversationId: doc.conversationId,
payload: payload
payload
};
// Execute the command
server(
connection,
new Query(self.bson, '$external.$cmd', command, {
numberToSkip: 0,
numberToReturn: 1
}),
function(err, r) {
authCommand(command, (err, result) => {
if (err) return callback(err, false);
const doc = result.result;
authProcess.transition(doc.payload, (err, payload) => {
if (err) return callback(err, false);
var doc = r.result;
const command = {
saslContinue: 1,
conversationId: doc.conversationId,
payload
};
mongo_auth_process.transition(doc.payload, function(err, payload) {
if (err) return callback(err);
authCommand(command, (err, response) => {
if (err) return callback(err, false);
// Perform the next step against mongod
var command = {
saslContinue: 1,
conversationId: doc.conversationId,
payload: payload
};
// Execute the command
server(
connection,
new Query(self.bson, '$external.$cmd', command, {
numberToSkip: 0,
numberToReturn: 1
}),
function(err, r) {
if (err) return callback(err, false);
var doc = r.result;
mongo_auth_process.transition(doc.payload, function(err, payload) {
// Perform the next step against mongod
var command = {
saslContinue: 1,
conversationId: doc.conversationId,
payload: payload
};
// Execute the command
server(
connection,
new Query(self.bson, '$external.$cmd', command, {
numberToSkip: 0,
numberToReturn: 1
}),
function(err, r) {
if (err) return callback(err, false);
var doc = r.result;
if (doc.done) return callback(null, true);
callback(new Error('Authentication failed'), false);
}
);
});
}
);
authProcess.transition(null, err => {
if (err) return callback(err, null);
callback(null, response);
});
});
}
);
});
});
});
});
}
);
};
});
});
}

@@ -233,0 +201,0 @@ // Add to store only if it does not exist

@@ -178,3 +178,3 @@ 'use strict';

// Known string options, only used to bypass Number coercion in `parseQueryStringItemValue`
const STRING_OPTIONS = new Set(['authsource']);
const STRING_OPTIONS = new Set(['authsource', 'replicaset']);

@@ -181,0 +181,0 @@ // Supported text representations of auth mechanisms

@@ -37,14 +37,16 @@ 'use strict';

// Grab Kerberos values if they exist, otherwise set them to null
let Kerberos = null;
let MongoAuthProcess = null;
function retrieveKerberos() {
let kerberos;
try {
const kerberos = requireOptional('kerberos');
if (kerberos) {
Kerberos = kerberos.Kerberos;
MongoAuthProcess = kerberos.processes.MongoAuthProcess;
try {
kerberos = requireOptional('kerberos');
} catch (err) {
if (err.code === 'MODULE_NOT_FOUND') {
throw new Error('The `kerberos` module was not found. Please install it and try again.');
}
throw err;
}
} catch (err) {
console.warn(err.message);
return kerberos;
}

@@ -54,7 +56,7 @@

const noEJSONError = function() {
throw new Error('The `mongodb-extjson` package was not found. Please install it and try again.');
throw new Error('The `mongodb-extjson` module was not found. Please install it and try again.');
};
// Facilitate loading EJSON optionally
const retrieveEJSON = function() {
function retrieveEJSON() {
let EJSON = null;

@@ -74,4 +76,5 @@ try {

}
return EJSON;
};
}

@@ -94,6 +97,5 @@ /*

relayEvents,
Kerberos,
MongoAuthProcess,
collationNotSupported,
retrieveEJSON
retrieveEJSON,
retrieveKerberos
};
{
"name": "mongodb-core",
"version": "3.1.7",
"version": "3.1.8",
"description": "Core MongoDB driver functionality, no bells and whistles and meant for integration not end applications",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc