Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-helmet

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-helmet

Security header middleware collection for koa

  • 3.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
236K
increased by9.69%
Maintainers
1
Weekly downloads
 
Created

What is koa-helmet?

koa-helmet is a middleware for Koa.js that helps secure your Koa applications by setting various HTTP headers. It is a Koa wrapper for the popular Helmet.js library, which is widely used in Express.js applications.

What are koa-helmet's main functionalities?

Content Security Policy

This feature helps prevent cross-site scripting (XSS) attacks and other cross-site injections by setting the Content-Security-Policy header.

const Koa = require('koa');
const helmet = require('koa-helmet');
const app = new Koa();

app.use(helmet.contentSecurityPolicy({
  directives: {
    defaultSrc: ["'self'"],
    styleSrc: ["'self'", 'https:']
  }
}));

app.listen(3000);

DNS Prefetch Control

This feature controls browser DNS prefetching by setting the X-DNS-Prefetch-Control header.

const Koa = require('koa');
const helmet = require('koa-helmet');
const app = new Koa();

app.use(helmet.dnsPrefetchControl({ allow: false }));

app.listen(3000);

Frameguard

This feature helps prevent clickjacking attacks by setting the X-Frame-Options header.

const Koa = require('koa');
const helmet = require('koa-helmet');
const app = new Koa();

app.use(helmet.frameguard({ action: 'deny' }));

app.listen(3000);

Hide Powered-By

This feature removes the X-Powered-By header to make it harder for attackers to see what technology your site is using.

const Koa = require('koa');
const helmet = require('koa-helmet');
const app = new Koa();

app.use(helmet.hidePoweredBy());

app.listen(3000);

HSTS

This feature adds the Strict-Transport-Security header to enforce secure (HTTP over SSL/TLS) connections to the server.

const Koa = require('koa');
const helmet = require('koa-helmet');
const app = new Koa();

app.use(helmet.hsts({ maxAge: 31536000 }));

app.listen(3000);

Other packages similar to koa-helmet

Keywords

FAQs

Package last updated on 31 May 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc