Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
hopjs-devkey
Advanced tools
This is a small devkey module for HopJS, it provides a basic framework for implementing devkeys.
We define a devkey as simply, a key which describes which is associated with a set of permissions.
For example:
{
//This key simply says - allow all calls
key1:"*",
//This key says - allow any call which has an input parameter of public=true
key2:"public:true",
//This key says - allow any call which has an input of public=true and enabled=false
key3:"public:true && enabled:false",
//This key only works when the environmental variable NODE_ENV isn't set to production
key4:"!$env.NODE_ENV:'production'",
//This key defines specific permissions for specific functions
key5:{
"User.create":"email:/.+\.foo.com/",
"User.delete":"$session.user.email:/+.foo.com/",
"MailBox.*":"to:/.+foo.com/",
},
//Don't allow this key to use IE
key6:"!$headers.agent:/MSIE/"
}
DevKeys can be used from a number of different providers:
var HopDevKey = require('hopjs-devkey');
//...
//Tell hop to use the devkey module
Hop.use(HopDevKey);
/* Let's setup for how we want to manage dev keys
1. Hit the memory cache for keys
2. Hit the symmetric key provider
3. Hit the redis cache key provider
4. Hit the signed key provider
5. Hit the http key provider
*/
//Fifth we'll use an HTTP key provider
var dkp = new DevKey.HttpKeyProvider("http://localhost:3000/api/key/:key");
//Fourth we'll use an public/private key provider
var skp = new DevKey.SignedKeyProvider("key.pub",dkp);
//Third we'll look in our redis cache for the key
var rkp = new DevKey.RedisCacheKeyProvider(skp,redis.createClient(),3000);
//Second we'll use a symmetic crypto key provider
var ckp = new DevKey.CryptoKeyProvider("foofoo",rkp);
//First we'll hit our memory cache of keys
var mkp = new DevKey.MemoryCacheKeyProvider(ckp,100);
//...
Hop.defineClass("User",User,function(api){
api.create("User.create","/user/").demand("email","username").requireDevKey(mkp);
api.delete("User.delete","/user/:id").requireDevKey(mkp);
});
You will need to decide how you manage and generate them, here are some example scenarios:
FAQs
DevKey module for HopJS
The npm package hopjs-devkey receives a total of 1 weekly downloads. As such, hopjs-devkey popularity was classified as not popular.
We found that hopjs-devkey 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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.