
Security Fundamentals
Turtles, Clams, and Cyber Threat Actors: Shell Usage
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.
mongodb-connection-model
Advanced tools
MongoDB connection model.
npm install --save mongodb-connection-model
var Connection = require('mongodb-connection-model');
hostname
(optional, String) ... Hostname of a MongoDB Instance [Default: localhost
].port
(optional, Number) ... TCP port of a MongoDB Instance [Default: 27017
].name
(optional, String) ... User specified name [Default: My MongoDB
].ns
(optional, String) ... A valid ns the user can read from [Default: undefined
].instance_id
(String) ... The mongoscope instance_id
[Default: localhost:27017
].driver_url
(String) ... The first argument mongoscope-server
passes to mongodb.connect
[Default: mongodb://localhost:27017/?slaveOk=true
].driver_options
(Object) ... The second argument mongoscope-server
passes to mongodb.connect
[Default: {}
].
sIt's useful to think of the remaining properties as two primary traits: authentication
and ssl
.
authentication
(optional, String) ... The desired authetication strategy [Default: NONE
]
NONE
Use no authentication.MONGODB
Allow the driver to auto-detect and select SCRAM-SHA-1 or MONGODB-CR depending on server capabilities.KERBEROS
X509
LDAP
var model = new Connection({
authentication: 'NONE'
});
console.log(model.driver_url);
>>> 'mongodb://localhost:27017/?slaveOk=true'
console.log(new Connection().driver_url);
>>> 'mongodb://localhost:27017/?slaveOk=true'
mongodb_username
(required, String)mongodb_password
(required, String)mongodb_database_name
(optional, String) [Default: admin
]var c = new Connection({
mongodb_username: 'arlo',
mongodb_password: 'w@of'
});
console.log(c.driver_url)
>>> 'mongodb://arlo:w%40of@localhost:27017/?slaveOk=true&authSource=admin'
console.log(c.driver_options)
>>> { uri_decode_auth: true,
db: { readPreference: 'nearest' },
replSet: { connectWithNoPrimary: true } }
kerberos_principal
(required, String) ... The format of a typical Kerberos V5 principal is primary/instance@REALM
.kerberos_password
(optional, String) ... [Default: undefined
].kerberos_service_name
(optional, String) ... [Default: mongodb
]. var c = new Connection({
kerberos_service_name: 'mongodb',
kerberos_password: 'w@@f',
kerberos_principal: 'arlo/dog@krb5.mongodb.parts',
ns: 'toys'
});
console.log(c.driver_url)
>>> 'mongodb://arlo%252Fdog%2540krb5.mongodb.parts:w%40%40f@localhost:27017/toys?slaveOk=true&gssapiServiceName=mongodb&authMechanism=GSSAPI'
console.log(c.driver_options)
>>> { uri_decode_auth: true,
db: { readPreference: 'nearest' },
replSet: { connectWithNoPrimary: true } }
@note (imlucas): Broken out as it's own state for UX consideration.
var model = new Connection({
kerberos_principal: 'arlo/admin@MONGODB.PARTS',
kerberos_password: 'B@sil',
kerberos_service_name: 'MongoDB',
ns: 'cat_toys'
});
console.log(model.driver_url);
>>> 'mongodb://arlo%252Fadmin%2540MONGODB.PARTS:B%40sil@localhost:27017/cat_toys?slaveOk=true&gssapiServiceName=MongoDB&authMechanism=GSSAPI'
x509_username
(required, String) ... The x.509 certificate derived user name, e.g. CN=user,OU=OrgUnit,O=myOrg,...
.var c = new Connection({
x509_username: 'CN=client,OU=arlo,O=MongoDB,L=Philadelphia,ST=Pennsylvania,C=US'
});
console.log(c.driver_url)
>>> 'mongodb://CN%253Dclient%252COU%253Darlo%252CO%253DMongoDB%252CL%253DPhiladelphia%252CST%253DPennsylvania%252CC%253DUS@localhost:27017?slaveOk=true&authMechanism=MONGODB-X509'
console.log(c.driver_options)
>>> { uri_decode_auth: true,
db: { readPreference: 'nearest' },
replSet: { connectWithNoPrimary: true } }
ldap_username
(required, String)ldap_password
(required, String)var c = new Connection({
ldap_username: 'arlo',
ldap_password: 'w@of',
ns: 'toys'
});
console.log(c.driver_url)
>>> 'mongodb://arlo:w%40of@localhost:27017/toys?slaveOk=true&authMechanism=PLAIN'
console.log(c.driver_options)
>>> { uri_decode_auth: true,
db: { readPreference: 'nearest' },
replSet: { connectWithNoPrimary: true } }
Note: Not to be confused with
authentication=X509
.
ssl
(optional, String) ... The desired ssl strategy [Default: NONE
]
NONE
No SSL.UNVALIDATED
No validation of certificate chain.SERVER
Driver should validate Server certificate.ALL
Driver should validate Server certificate and present valid Certificate.Do not use SSL for anything.
Use SSL but do not perform any validation of the certificate chain.
The driver should validate the server certificate and fail to connect if validation fails.
The driver must present a valid certificate and validate the server certificate.
@todo (imlucas) Update this from last week's whiteboard session.
Apache 2.0
FAQs
MongoDB connection model
The npm package mongodb-connection-model receives a total of 0 weekly downloads. As such, mongodb-connection-model popularity was classified as not popular.
We found that mongodb-connection-model demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 34 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security Fundamentals
The Socket Threat Research Team uncovers how threat actors weaponize shell techniques across npm, PyPI, and Go ecosystems to maintain persistence and exfiltrate data.
Security News
At VulnCon 2025, NIST scrapped its NVD consortium plans, admitted it can't keep up with CVEs, and outlined automation efforts amid a mounting backlog.
Product
We redesigned our GitHub PR comments to deliver clear, actionable security insights without adding noise to your workflow.