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.
@bscotch/emitter
Advanced tools
Existing EventEmitter libraries typically do not provide much support for indicating what events and payloads are available on a given emitter. This library adds that support to the popular EventEmitter2 library.
Events can be described as a string (when just the event name is needed because there is no expected payload) or as an object with a payload:
import {createEmitter} from '@bscotch/emitter';
type MySimpleEvent = "my-simple-event";
interface MyComplexEvent {
name: "my-complex-event";
// The payload must be a *tuple* of the arguments that will
// be passed to the event handler.
payload: [arg0: string, arg1: { foo: number }];
}
// For best results, events should be collected in a tuple type
type MyEvents = [MySimpleEvent, MyComplexEvent];
const emitter = createEmitter<MyEvents>();
// Now you'll have typed emitter methods!
emitter.on('my-simple-event', () => {});
emitter.emit('my-simple-event');
emitter.on('my-complex-event', (arg0, arg1) => {}); // <- callback is typed!
emitter.emit('my-complex-event', 'foo', { foo: 1 }); // <- arguments are typed!
FAQs
Extension of eventemitter2, adding typed events.
The npm package @bscotch/emitter receives a total of 60 weekly downloads. As such, @bscotch/emitter popularity was classified as not popular.
We found that @bscotch/emitter 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.