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.
@hazae41/box
Advanced tools
Rust-like Box for TypeScript
npm i @hazae41/box
@hazae41/result
The Box<T extends Disposable>
will:
T
import { Box } from "@hazae41/box"
class D {
[Symbol.dispose]() {
console.log("it should only happen once")
}
}
/**
* At the end of this block, D will only be disposed once
*/
{
using box = new Box(new D())
using box2 = box.move()
}
This means the typical object holding a Box looks like this
import { Box } from "@hazae41/box"
class MyWrapper<T extends Disposable> {
private constructor(
/**
* Rule 2. hold as box
**/
readonly box: Box<T>
) {}
[Symbol.dispose]() {
/**
* Rule 3. dispose any box you hold
**/
this.box[Symbol.dispose]()
}
static create<T extends Disposable>(box: Box<T>) {
/**
* Rule 3. own any box you want to hold
**/
return new MyWrapper(box.move())
}
use() {
/**
* Rule 1. only pass as box
**/
something(this.box)
}
export(): T {
/**
* Rule 4. unwrap on return
**/
return this.box.unwrap()
}
}
FAQs
Rust-like Box and similar objects for TypeScript
The npm package @hazae41/box receives a total of 1,058 weekly downloads. As such, @hazae41/box popularity was classified as popular.
We found that @hazae41/box demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.