
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
This library provides object references for Ruby as well as some common utilities for working with references. Object references are used to point to other objects and come in three distinct flavors that interact differently with the garbage collector.
Ref::StrongReference
- This is a plain old pointer to another object.Ref::WeakReference
- This is a pointer to another object, but it is not seen by the garbage collector and the memory used by the object can be reclaimed at any time.Ref::SoftReference
- This is similar to a weak reference, but the garbage collector is not as eager to reclaim the referenced object.All of these classes extend from a common Ref::Reference
class and have a common interface.
Weak and soft references are useful when you have instantiated objects that you may want to use again but can recreate if necessary. Since the garbage collector determines when to reclaim the memory used by the objects, you don't need to worry about bloating the Ruby heap.
ref = Ref::WeakReference.new("hello")
ref.object # should be "hello"
ObjectSpace.garbage_collect
ref.object # should be nil (assuming the garbage collector reclaimed the reference)
This library also includes tools for some common uses of weak and soft references.
Ref::WeakKeyMap
- A map of keys to values where the keys are weak referencesRef::WeakValueMap
- A map of keys to values where the values are weak referencesRef::SoftKeyMap
- A map of keys to values where the keys are soft referencesRef::SoftValueMap
- A map of keys to values where the values are soft referencesRef::ReferenceQueue
- A thread safe implementation of a queue that will add references to itself as their objects are garbage collected.Ruby does come with the WeakRef
class in the standard library. However, there are issues with this class across several different Ruby runtimes. This gem provides a common interface to weak references that works across MRI, Ruby Enterprise Edition, YARV, JRuby and Rubinius.
WeakRef
with a lighter weight version of delegation and works very well.WeakRef
is unsafe to use because the garbage collector can run in a different system thread than a thread allocating memory. This exposes a bug where a WeakRef
may end up pointing to a completely different object than it originally referenced.WeakRef
.FAQs
Unknown package
We found that ref demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.