Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@fastify/etag
Advanced tools
A plugin for Fastify that automatically generates HTTP ETags according to RFC2616-sec13.
The plugin can optionally send a 304 status code when an ETag matches the if-none-match header.
npm i @fastify/etag
'use strict'
const Fastify = require('fastify')
const Etag = require('@fastify/etag')
const app = Fastify()
app.register(Etag)
app.get('/', async (req, reply) => {
return { hello: 'world' }
})
app.get('/manual-etag', async (req, reply) => {
// This will disable automatic ETag generation
// It will still return a 304 if the ETag matches
reply.header('etag', '"foobar"')
return 'world'
})
app.listen(3000)
algorithm
: all hashing algorithms the Node.js crypto
module supports, and 'fnv1a'
. Default: 'sha1'
.
weak
: generates weak ETags by default. Default: false
.
By default, the plugin sends a 304 status code when the ETag is equal to the Etag specified by the if-none-match request header.
This is often the desired behaviour, but can be disabled by setting replyWith304: false
.
The fnv1a logic was forked from https://github.com/sindresorhus/fnv1a and adapted to support buffers.
Generating an etag will always be slower than not generating an etag. The generation speed also depends on the payload size and type (buffer or string):
'fnv1a'
'md5'
'sha1'
(default)MIT
FAQs
Automatically generate etags for HTTP responses, for Fastify
The npm package @fastify/etag receives a total of 11,786 weekly downloads. As such, @fastify/etag popularity was classified as popular.
We found that @fastify/etag demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.