Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
@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 10,798 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.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.