Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
nitro-helmet
Advanced tools
observerly's Helemt (HTTP security headers) event handler for the Nitro web server
nitro native Helmet-esque security headers.
npm install nitro-helmet
pnpm add nitro-helmet
yarn add nitro-helmet
nitro Helmet is built upon the h3 library. To read more about h3, please consult the h3 repository.
nitro-helmet aims to provide a simple wrapper to define standard security headers for any event handler per nitro event handler, or per route. To use it, simply import the defineHelmetEventHandler
function and wrap your event handler with it as follows:
import { defineHelmetEventHandler } from 'nitro-helmet'
const handler = eventHandler(async event => {
// ...
})
export default defineHelmetEventHandler(handler)
...or... using as nitro middleware:
// :file middleware/helmet.ts
import { helmetEventHandler } from 'nitro-helmet'
export default helmetEventHandler(_event => {}, {
crossOriginResourcePolicy: 'cross-origin'
// ... add your options overrides here
})
If you would like to override the default options, you can do so as follows:
import { defineHelmetEventHandler } from 'nitro-helmet'
const handler = eventHandler(async event => {
// ...
})
const options: H3HelmetOptions = {}
export default defineHelmetEventHandler(handler, {
crossOriginResourcePolicy: 'same-origin',
crossOriginOpenerPolicy: 'same-origin',
crossOriginEmbedderPolicy: 'require-corp',
contentSecurityPolicy: "default-src 'self';base-uri 'self'",
originAgentCluster: '?1',
referrerPolicy: 'no-referrer',
strictTransportSecurity: 'max-age=15552000; includeSubDomains',
xContentTypeOptions: 'nosniff',
xDNSPrefetchControl: 'off',
xDownloadOptions: 'noopen',
xFrameOptions: 'SAMEORIGIN',
xPermittedCrossDomainPolicies: 'none',
xXSSProtection: '0'
})
The defineHelmetEventHandler
functions take two arguments:
handler
: the event handler to wrap of type EventHandler<T>
, which will ensure typesafety for the event handler return type.options
: the options to pass to the cors handler of type H3HelmetOptions
.FAQs
observerly's Helemt (HTTP security headers) event handler for the Nitro web server
The npm package nitro-helmet receives a total of 23 weekly downloads. As such, nitro-helmet popularity was classified as not popular.
We found that nitro-helmet 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.