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.
simple publish/subscribe mode. 一套发布订阅模式,可快速的订阅及发布事件。
npm i -S c-pubsub
pubsub.on
订阅事件, pubsub.emit
发布事件
import pubsub from 'c-pubsub';
// 订阅事件
pubsub.on('event', (arg) => {
console.log(arg);
});
// 发布事件
pubsub.emit('event', 'Hello');
// Hello
pubsub.one
也可以订阅一次性事件,监听到一次事件后就会自动卸载事件。
pubsub.one('event', (arg) => {
console.log(arg);
});
pubsub.emit('event', 'Hello'); // Hello
pubsub.emit('event', 'Hello'); // 已经自动卸载过事件了,所不会有反应。
pubsub.off
可以卸载事件,会卸载该事件下的所有回调。
pubsub.on('event', (arg) => {
console.log('1', arg);
});
pubsub.on('event', (arg) => {
console.log('2', arg);
});
pubsub.one('event', (arg) => {
console.log('3', arg);
});
pubsub.off('event'); // 卸载了 event 事件
pubsub.emit('event', 'Hello'); // 不会有任何反应,因为所有监听 event 的回调函数都被卸载了。
FAQs
simple publish/subscribe mode
The npm package c-pubsub receives a total of 2 weekly downloads. As such, c-pubsub popularity was classified as not popular.
We found that c-pubsub 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.