Security header middleware collection for Koa applications that wraps Helmet.js
91
A Koa middleware that adds security headers to disable legacy XSS filtering in browsers.
Modern browsers once included built-in XSS filters that attempted to detect and block cross-site scripting attacks. However, these filters were found to have security vulnerabilities of their own and could be exploited. The current best practice is to explicitly disable these legacy XSS filters using HTTP headers.
Create a Koa middleware application that:
/health that returns a JSON response with { status: "ok" }/api/content that returns JSON data { message: "Hello, World!" }The middleware should ensure that responses include the appropriate security header to disable legacy XSS filtering mechanisms in older browsers.
@generates
// Server should export a function to start the server
// Returns the server instance
function startServer(port) {
// IMPLEMENTATION HERE
}
module.exports = { startServer };/health endpoint returns { status: "ok" } with 200 status @test/api/content endpoint returns the expected JSON message @testProvides the web application framework.
Provides security middleware for setting HTTP headers.
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