在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:venables/koa-helmet开源软件地址:https://github.com/venables/koa-helmet开源编程语言:JavaScript 100.0%开源软件介绍:koa-helmetkoa-helmet is a wrapper for helmet to work with koa. It provides important security headers to make your app more secure by default. Installationnpm i koa-helmet
# or:
yarn add koa-helmet UsageUsage 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. Exampleimport 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); TestingTo run the tests, simply run
Versioning
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论