
Research
Security News
Malicious npm Packages Target BSC and Ethereum to Drain Crypto Wallets
Socket uncovered four malicious npm packages that exfiltrate up to 85% of a victim’s Ethereum or BSC wallet using obfuscated JavaScript.
github.com/RyanJarv/ListQueue
Note: Figuring out wait groups in some cases is a bit finicky currently. The group that lq.Wait() waits on is exposed publicly for this reason at the moment, in case you need to add anything to it.
NewListQueue returns a queue which ensures in order delivery of every past and future event to every subscriber.
q := lq.NewListQueue[int]()
q.Add(1, 2)
q.Each() will return a channel which iterates over past and future arguments added with q.Add(...)
go func() {
for v := range q.Each() {
// Prints: 1
// 2
fmt.Println(v)
q.Done()
}
}()
q.Add(3, 4)
q.Close()
for v := range q.Each() {
// Prints: 1
// 2
// 3
// 4
fmt.Println(v)
q.Done()
}
import "github.com/RyanJarv/ListQueue"
const ChanSize = 10
type IListQueue[T any] interface {
Add(...T)
Each() chan T
Close()
Wait()
}
type IWaitGroup interface {
Add(i int)
Done()
Wait()
}
type ListQueue[T any] struct {
// Has unexported fields.
}
NewListQueue returns a queue which ensures exactly once, in order delivery of every past and future event to every subscriber.
q := listQueue.NewListQueue[int]()
q.Add(1, 2)
ch := q.Each()
q.Each() will return a channel which can be used to iterate over past and future arguments added with Add(...). For each item returned from this channel. The queue needs to be closed after all items have been added with Add(...) for loops using q.Each() to exit.
go func() {
for v := range ch {
// Prints: 1
// 2
fmt.Println(v)
q.Done()
}
Loops created after Close() is called will still work as expected, but new values can't be added with Add(...).
q.Add(3, 4)
q.Close()
for v := range q.Each() {
// Prints: 1
// 2
// 3
// 4
fmt.Println(v)
q.Done()
}
}()
Add adds all passed arguments to the list and wakes up any paused goroutines to continue reading from the list.
Each returns a channel which will be sent all current and future items passed to Add in the order they were added.
FAQs
Unknown package
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 uncovered four malicious npm packages that exfiltrate up to 85% of a victim’s Ethereum or BSC wallet using obfuscated JavaScript.
Security News
TC39 advances 9 JavaScript proposals, including Array.fromAsync, Error.isError, and Explicit Resource Management, which are now headed into the ECMAScript spec.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.