Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Tiny JavaScript library to handle event callback registration.
Highlights:
Install the library:
npm install abonnement --save
Use it in any JavaScript object:
// Create a new context
const events = abonnement();
// Get an registering function
const onNewData = events.getRegisterHandler('newData');
// Subscribe to "newData" events
onNewData(data => console.log(data));
// Trigger a newData event
events.trigger('newData');
The main purpose of abonnement is to simplify modular architecture in an ES5 context.
The event handler pattern allow us to connect modules without having explicit dependencies.
// First, I create one module that will handle some data
function createBack() {
const events = abonnement();
setTimeout(() => events.trigger('end'), 3000);
return {
onEnd: events.getRegisterHandler('end')
};
}
// Then, I create another module that will handle the output
function createFront() {
function display(message) {
console.log(message);
}
return {
display
};
}
// Finally, I create the App that will links the modules together
const back = createBack();
const front = createFront();
back.onEnd(function() {
front.display("Time out!");
});
const events = abonnement();
// Trigger an event
events.trigger('end');
// Trigger an event with data
events.trigger('newData', { id: 'john' });
const events = abonnement();
// Subscribe to an event
const onEnd = events.getRegisterHandler('end');
onEnd(() => console.log('Time out!'));
// Treat event data
const onNewData = events.getRegisterHandler('newData');
onNewData(data => console.log(`New user connected: ${data.id}`));
// Filtering events by the data
onNewData({ id: 'john' }, data => console.log('John is connected'));
// Filtering events by id
onNewData('john', data => console.log('John is connected'));
// Declare a custom id field
const onNewData = events.getRegisterHandler('newData', 'name');
onNewData('John', data => console.log('John is connected'));
events.trigger('newData', { id: 76, name: 'John' });
MIT. Copyright (c) Thomas Zilliox.
FAQs
A JavaScript mixin to handle callback registration.
We found that abonnement 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.