Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Bind Json: Reactive way to read/write json files.
npm install bjson --save
When you need to edit a json file, what you do?
With bjson:
settings.json
{}
whatever.js
var bjson = require('bjson');
var settings = bjson('settings'); // will read or create settings.json
settings.prop = 'bar';
settings.json:
{
"prop": "bar"
}
You can watch changes with a instance of Object.observe
passed as callback argument.
settings.json:
{
"prop": "bar"
}
whatever.js
var bjson = require('bjson');
var settings = bjson('settings', function(observe){
observe.on('change', function(changes){
console.log('Path:', changes.path);
console.log('Old Value:', changes.oldValue);
console.log('New Value:', changes.value);
console.log('-----');
});
});
settings.prop = 'foo';
settings.otherprop = 'bar';
Log output:
Path: prop
Old Value: bar
New Value: foo
-----
Path: otherprop
Old Value: undefined
New Value: bar
-----
settings.json:
{
"prop": "foo",
"otherprop": "bar"
}
var bjson = require('bjson');
var settings = bjson('settings', function(observe){
observe.on('add', function(changes){});
observe.on('update', function(changes){});
observe.on('delete', function(changes){});
observe.on('reconfigure', function(changes){});
observe.on('change', function(changes){}); // fired when any of the above events are emitted
});
changes
path
: full path to the property, including nesting
name
: name of the path
type
: name of the event
object
: object
value
: current value for the given path. same as object[name]
oldValue
: previous value of the property
Example:
var bjson = require('bjson');
var settings = bjson('settings', function(observe){
observe.on('change', function(changes){
console.log(changes);
});
});
settings.foo = 'bar'
//log:
// { path: 'foo',
// name: 'foo',
// type: 'add',
// object: { foo: 'bar' },
// value: 'bar',
// oldValue: undefined }
FAQs
Bind Json: Reactive way to read/write json files.
The npm package bjson receives a total of 6 weekly downloads. As such, bjson popularity was classified as not popular.
We found that bjson 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
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.