
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
supergoose
Advanced tools
Mongoose simple plugin adding some handy functions.
npm install supergoose
Use mongoose's plugin method to extend your models with supergoose
var supergoose = require('supergoose')
var ClickSchema = new Schema({ ... });
ClickSchema.plugin(supergoose, [options]);
var Click = mongoose.model('Click', ClickSchema)
Arguments
Valid Options
Adds find or create functionality to mongoose models. This is handy for libraries like passport.js which require it
Click.findOrCreate({ip: '127.0.0.1'}, function(err, doc) {});
Click.findOrCreate({ip: '127.0.0.1'}, {browser: 'Chrome'}, function(err, click) {})
Arguments
Valid Options
Parses the complex validation errors return from mongoose into a simple array of messages to be displayed as flash messages or something similar
var supergoose = require('supergoose')
var ClickSchema = new Schema({ip: {type: String, required: true}});
Click.plugin(supergoose, {messages: {'required': '%s is a required field'}});
var Click = mongoose.model('Click', ClickSchema);
The Click model now has an errors static method
Click.create({}, function(err, click) {
if(err) {
Click.errors(err, function(messages) {
console.log(messages);
// outputs ['ip is a required field']
})
}
});
Arguments
Arguments
Returns
When a relationship is created, it adds a path that refers to the related model on the schema that creates it. The relationship object has one property:
var supergoose = require('supergoose')
var mongoose = require('mongoose')
var ClickSchema = new Schema({ip: {type: String, required: true}, _user: {type: ObjectId}});
var UserSchema = new Schema({name: String})
UserSchema.plugin(supergoose, {instance: mongoose});
UserSchema.parentOf('Click', 'clickCollection').enforceWith('_user')
Arguments
Valid Options
MIT License
FAQs
Mongoose plugin for simple addons like findOrCreate
The npm package supergoose receives a total of 193 weekly downloads. As such, supergoose popularity was classified as not popular.
We found that supergoose demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.