
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
fastify-redis-mock
Advanced tools
Plugin to share a common Redis mock connection across Fastify.
Fastify Redis mock connection plugin, with this you can share the same Redis mock connection in every part of your server.
This package is useful if you wish to unittest your Fastify project, without the need to run Redis itself.
Full credit goes to the Fastify team for building fastify-redis, and stipsan for building ioredis-mock.
For documentation, please refer to either the Fastify-redis docs, or ioredis-mock docs.
npm i fastify-redis-mock --save
Add it to your project with register
and you are done!
You can access the Redis mock client via fastify.redis
.
const fastify = require('fastify')
const redis = require('fastify-redis')
const redisMock = require('fastify-redis-mock')
// Register the mock for e.g. unit tests
const redisInstance = process.env.ENVIRONMENT === 'unittest' ? redisMock : redis;
fastify.register(redisInstance, [options])
fastify.get('/foo', (req, reply) => {
const { redis } = fastify
redis.get(req.query.key, (err, val) => {
reply.send(err || val)
})
})
fastify.post('/foo', (req, reply) => {
const { redis } = fastify
redis.set(req.body.key, req.body.value, (err) => {
reply.send(err || { status: 'ok' })
})
})
fastify.listen(3000, err => {
if (err) throw err
console.log(`server listening on ${fastify.server.address().port}`)
})
This project is copied from:
Licensed under MIT.
FAQs
Plugin to share a common Redis mock connection across Fastify.
The npm package fastify-redis-mock receives a total of 1,648 weekly downloads. As such, fastify-redis-mock popularity was classified as popular.
We found that fastify-redis-mock 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
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.