Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.
/ koa-helmet Public archive
forked from venables/koa-helmet

Important security headers for koa

License

Notifications You must be signed in to change notification settings

mdoi2/koa-helmet

This branch is 7 commits behind venables/koa-helmet:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Nov 27, 2024
c5e1427 · Nov 27, 2024
Nov 12, 2024
Nov 12, 2024
Nov 20, 2024
Mar 4, 2017
Feb 25, 2020
Feb 15, 2017
Nov 14, 2024
Nov 12, 2024
Nov 20, 2024
Nov 27, 2024
Nov 27, 2024
Nov 12, 2024
Nov 12, 2024

Repository files navigation

koa-helmet

Version Downloads

koa-helmet is a wrapper for helmet to work with koa. It provides important security headers to make your app more secure by default.

Installation

npm i koa-helmet helmet

# or:

yarn add koa-helmet helmet

Usage

Usage is the same as helmet

Helmet offers 11 security middleware functions:

// This...
app.use(helmet());

// ...is equivalent to this:
app.use(helmet.contentSecurityPolicy());
app.use(helmet.dnsPrefetchControl());
app.use(helmet.expectCt());
app.use(helmet.frameguard());
app.use(helmet.hidePoweredBy());
app.use(helmet.hsts());
app.use(helmet.ieNoOpen());
app.use(helmet.noSniff());
app.use(helmet.permittedCrossDomainPolicies());
app.use(helmet.referrerPolicy());
app.use(helmet.xssFilter());

You can see more in the documentation.

Example

import Koa from "koa";
import helmet from "koa-helmet";

const app = new Koa();

app.use(helmet());

app.use((ctx) => {
  ctx.body = "Hello World";
});

app.listen(4000);

Testing

To run the tests, simply run

npm test

Versioning

  • koa-helmet >=2.x (master branch) supports koa 2.x
  • koa-helmet 1.x (koa-1 branch) supports koa 0.x and koa 1.x

About

Important security headers for koa

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 67.6%
  • JavaScript 32.4%