Web application security middleware for koa, forked from krakenjs/lusca. Version 2.2.0 provides CSRF protection, Content Security Policy (CSP), X-Frame-Options (clickjacking), P3P privacy headers, HSTS, and XSS protection. This package is actively maintained but does not support Koa v2 (async/await) or modern ESM. Release cadence is low; last update was 2019. Key differentiator: it brings lusca-style security to Koa v1, but developers should consider alternatives like 'koa-helmet' for Koa v2.
npm install koa-luscaVerified import paths — ran on the pinned version, not inferred.
Set up Koa v1 app with CSRF, X-Frame-Options, HSTS, and XSS protection using koa-lusca.
Use koa-helmet or another Koa v2 compatible security library.
Remove p3p configuration from lusca options.
Add koa-session or similar session middleware before lusca csrf.
Check the documentation for exact option names and values.
Switch to koa-helmet or a Koa v2 compatible package.
Use Koa v1 or migrate to koa-helmet for Koa v2.
Use const lusca = require('koa-lusca'); instead of import.Use lusca({...}) with an options object or call individual methods like lusca.csrf().Ensure session middleware is used and include _csrf field in form data or header.