
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
redis-toolbox
Advanced tools
Redis utilities that allows developers to utilize Redis for Session Management, Job Queue processing and so on.
Redis utilities that allows developers to utilize Redis for Session Management, Job Queue processing and so on.
npm i redis-toolbox --save
The session tools provided here allows you to turn your redis host into a session manager for anything. It is designed to be agnostic to any specific product type and are all promise based which can be used for Async/Await calls
import {
RedisSessionManager, RedisSessionOptions, onRedisSessionErrorCallback, RedisSessionObject,
} from 'redis-toolbox';
const redisOptions: RedisSessionOptions = {
host: process.env.REDIS_HOST,
port: parseInt(process.env.REDIS_PORT || '80', 10),
db: process.env.REDIS_DB ? parseInt(process.env.REDIS_DB, 10) : undefined,
password: process.env.REDIS_PASS,
sessionMaxTTL: process.env.USER_SESSION_MAX_TTL ? parseInt(process.env.USER_SESSION_MAX_TTL, 10) : 21600,
sessionRefreshTTL: true,
sessionInactiveTTL: process.env.USER_SESSION_IDLE_TTL ? parseInt(process.env.USER_SESSION_IDLE_TTL, 10) : 1800,
};
const onSessionError: onRedisSessionErrorCallback = async (err: Error): Promise<boolean> => {
// do whatever async tasks like send metrics, alerts, etc.
console.log(`Error on session: ${err.message}`);
return false;
};
const session = new RedisSessionManager(redisOptions, onSessionError);
On the sample above, we first imported the major components of a redis session.
Next we had defined the redis options. The rest of the configurations are from ioredis (host, port, etc.) what is added are the 3 session behavior properties
After that we need to implement the error callback defined by onRedisSessionErrorCallback . This allows you the chance to perform anything necessary before the module throws an Error. You can send alerts, metrics etc. on this function. this expects a return value however of boolean. Returning true acknowledges that you have handled the error yourself and telling the module to "do not bother throwing the error". sending false makes the module proceed to throw the error.
Finally, we create a new session instance from RedisSessionManager. It requires only 2 parameters which we did in the 2nd and 3rd step. The RedisSessionOptions object and the Error callback.
We can now start utilizing the session functions
const newsession: RedisSessionObject = await session.createSession();
const samesession: RedisSessionObject = await session.retrieveSession(newsession.sessionId);
const delta = { name: 'Adonis Lee Villamor', email: 'adonisv79@gmail.com' }
const isUpdated = await session.updateSession(samesession.sessionId, delta as any); //isUpdated will be true if success
const isDestroyed = await session.destroySession(samesession.sessionID);
FAQs
Redis utilities that allows developers to utilize Redis for Session Management, Job Queue processing and so on.
We found that redis-toolbox 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
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.