Security header middleware collection for Koa applications that wraps Helmet.js
91
Build a Koa API server with route-specific security configurations that apply different security policies based on the sensitivity level of each endpoint.
@generates
Your API server should have three route groups with distinct security requirements:
Routes under /public/* should have relaxed security suitable for public content:
'unsafe-inline') in style sourcesRoutes under /api/* should have moderate security for API endpoints:
Routes under /admin/* should have maximum security for sensitive operations:
'self' sources (no unsafe-inline or unsafe-eval)/public/content allows images from any source in CSP headers @test/api/data has frame-options set to DENY @test/admin/dashboard has HSTS max-age of at least 31536000 seconds @test/**
* Creates and configures a Koa application with route-specific security
* @returns {Object} Koa application instance
*/
function createApp() {
// Implementation
}
module.exports = { createApp };Provides the web framework for building the API server.
Provides security header middleware with configurable options for different routes.
Provides routing capabilities for organizing endpoints into different route groups.
Install with Tessl CLI
npx tessl i tessl/npm-koa-helmetdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10