
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
cluster-shared-memory
Advanced tools
Cross-process storage acts like shared memory for Node.js applications which use the cluster module.
If you are looking for a tool to share the physical memory, cluster-shared-memory can not meet your needs. You can only use it to share data between processes.
It provides in-memory storage managed by the master process, and the workers communicate with the master through IPC. It's basically used in the Node.js cluster applications to share data between processes.
It supports reading and writing objects in shared memory storage, mutually exclusive access between processes, listening objects in shared memory storage, and an LRU cache.
const cluster = require('cluster');
require('cluster-shared-memory');
if (cluster.isMaster) {
for (let i = 0; i < 2; i++) {
cluster.fork();
}
} else {
const sharedMemoryController = require('cluster-shared-memory');
// Note: it must be a serializable object
const obj = {
name: 'Tom',
age: 10,
};
// Set an object
await sharedMemoryController.set('myObj', obj);
// Get an object
const myObj = await sharedMemoryController.get('myObj');
// Mutually exclusive access
await sharedMemoryController.mutex('myObj', async () => {
const newObj = await sharedMemoryController.get('myObj');
newObj.age = newObj.age + 1;
await sharedMemoryController.set('myObj', newObj);
});
}
Set the options of the LRU cache. Only available on the master process.
Note that this will recreate a new LRU cache.
{ max: 10000, maxAge: 1000 * 60 * 5 }
.Set an object to the shared memory storage.
Get an object from the shared memory storage.
Remove an object from the shared memory storage.
Get the lock of an object. If you want to perform mutually exclusive operations, you must get the lock first. If the lock is already get by another process, this operation will be blocked until the lock has been returned.
Remember to release the lock after you finishing the operations!
Release the lock of an object. After releasing the lock, one of other blocked requests can get the lock.
Auto get and release the Lock of an object.
Listen an object.
Set an object to the LRU cache.
Get an object from the LRU cache.
Remove an object from the LRU cache.
FAQs
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
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.