
Research
/Security News
Intercom’s npm Package Compromised in Ongoing Mini Shai-Hulud Worm Attack
Compromised intercom-client@7.0.4 npm package is tied to the ongoing Mini Shai-Hulud worm attack targeting developer and CI/CD secrets.


MongoCrypt is a service to encrypt and decrypt your data stored in a MongoDB database. It was also designed with these principles in mind:
const collection = "users";
const query = {name: "eykjs"}
// with mongodb's sdk
db.collection(collection).findOne(query, (err, res) => {
if(!err){
console.log("Email: " + res.email);
}else{
console.log("Error!");
}
});
// with mongocrypt
mongocrypt.db.collection(collection).findOne(query).then(res => {
if(res){
console.log("Email: " + res.email);
}else{
console.log("Error!");
}
});
npm install mongocrypt
const mongocrypt = require('mongocrypt');
const database_url = "mongodb://yourserver:port/yourdatabase";
mongocrypt.db.connect(url).then(err => {
if(!err) {
...
}
});
Everyone is invited to fork this project and work on it. If you create a pull request and your code is good and useful for this project, it will be merged into mongocrypt. Collaborators are also searched. For future plans have a look at Trello
The mongocrypt functions are based on the MongoDB SDK functions. The structure is always the same. You can see each equivalent in the list below.
Important before using database functions:
// Be sure you connected to the database
if(mongocrypt.db.isConnected()){
// Set the encryption key
// Important: It has to be a string with the length of 32
mongocrypt.encryption.set(yourKey);
}else{
// have a look at the Installation & Setup section
}
Standard usage:
The MongoDB JS SDK function compared with the mongocrypt function
db.collection(collection).function(parameter, callback(err, res))db.collection(collection).function(parameter).then(err)The parameters of the mongocrypt functions are identical to the common SDK ones. You can find a list of them here. This principle works for all mongocrypt functions except find() and findOne()
// Example how to use find() and findOne()
/* The option objects takes 3 parameters. The sort object a limit number and a filter object.
All 3 can also be null.
*/
const query = {pro: true}
const options = {sort: {rank: 1}, limit: 5, filter: {email: true}
}
const canAlsoBeOptions = null;
mongocrypt.collection("users").find(query, options).then(res => {
if(res){
console.log("Email: " + res[0].email)
} else {
console.log("An error appeared");
}
})
// findOne() works on a similar way but it only takes a filter as second parameter
mongocrypt.collection("users").findOne(query, {email: true}).then(res => {})
mongocrypt.encryption.setKey(key)mongocrypt.db.connect(url).then(err)mongocrypt.db.isConnected() returns true or falsemongocrypt.db.close()mongocrypt.db.collection(collection).insertOne(object).then(err)mongocrypt.db.collection(collection).insertMany(array).then(err)mongocrypt.db.collection(collection).updateOne(query, object).then(err)mongocrypt.db.collection(collection).updateMany(query, object).then(err)mongocrypt.db.collection(collection).findOne(query, filter).then(res)mongocrypt.db.collection(collection).find(query, options).then(res) options descripted abovemongocrypt.db.collection(collection).deleteOne(query).then(err)mongocrypt.db.collection(collection).deleteMany(query).then(err)mongocrypt.db.collection(collection).drop(query).then(err)please connect first to a database with mongocrypt.db.connect(url)please set an encryption key first with mongocrypt.encryption.setKey(key)the key has to have a length of 32 characters.Do not hesitate to open an issue or send me a message on Twitter
FAQs
Encrypt, store and recieve data from MongoDB with almost native functions
The npm package mongocrypt receives a total of 307 weekly downloads. As such, mongocrypt popularity was classified as not popular.
We found that mongocrypt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Research
/Security News
Compromised intercom-client@7.0.4 npm package is tied to the ongoing Mini Shai-Hulud worm attack targeting developer and CI/CD secrets.

Research
Socket detected a malicious supply chain attack on PyPI package lightning versions 2.6.2 and 2.6.3, which execute credential-stealing malware on import.

Research
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.