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.
Tiniest event bus possible, type-safe
// common base
import picobus from `picobus`
const bus = picobus<PayloadType>()
// subscriber
const callback = payload => handle(payload)
bus.listen(callback)
//…later, when it's not needed anymore
bus.unlisten(callback)
// publisher
bus.dispatch(payload)
Create a new bus for every event type:
const localeBus = picobus<Locale>()
const themeBus = picobus<Theme>()
const currentUserBus = picobus<UserData>()
const bus = picobus<boolean>()
bus.dispatch(true) // works
bus.dispatch(null) // TS error: Argument of type 'null' is not assignable to parameter of type 'boolean'.
bus.dispatch() // TS error: Expected 1 arguments, but got 0.
const bus = picobus()
bus.dispatch() // works
bus.dispatch(false) // TS error: Expected 0 arguments, but got 1.
bus.dispatch(null) // TS error: Expected 0 arguments, but got 1.
const bus = picobus<boolean | undefined>()
bus.dispatch(true) // works
bus.dispatch() // works
bus.dispatch(null) // TS error: Argument of type 'null' is not assignable to parameter of type 'boolean'.
import { Picobus } from `picobus`
function consumeBus (bus : Picobus<boolean>) {
bus.listen(payload => {
// payload is now correctly typed 👍
handleBoolean(payload)
})
}
You can also import Picolistener
and Picodispatch
, depending on your use-case.
FAQs
Tiniest message bus possible, type-safe
The npm package picobus receives a total of 1 weekly downloads. As such, picobus popularity was classified as not popular.
We found that picobus 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.