Security header middleware collection for Koa applications that wraps Helmet.js
91
Build a Koa application that implements a custom security middleware stack with different security policies for different route groups.
Your application should have three route groups with distinct security configurations:
/api/public/*)These routes serve public data and need:
/admin/*)These routes require stricter security:
/content/*)These routes serve user content and need:
/api/public/data returns response with X-Content-Type-Options header set to nosniff @test/api/public/data returns response with Referrer-Policy header set to no-referrer @test/admin/dashboard returns response with Strict-Transport-Security header containing max-age=31536000 and includeSubDomains @test/admin/dashboard returns response with X-Frame-Options header set to DENY @test/content/images returns response with Content-Security-Policy header that allows images from any source @test@generates
/**
* Creates and configures a Koa application with custom security middleware.
* Returns the configured Koa app instance.
*/
function createApp() {
// Implementation here
}
module.exports = { createApp };Provides the web application framework.
@satisfied-by
Provides security header middleware.
@satisfied-by
Provides routing capabilities for different route groups.
@satisfied-by
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