Express middleware to serve a security.txt policy file at the standard /.well-known/security.txt or /security.txt endpoint. Current stable version 4.0.1. Released via semantic-release; adheres to the security.txt RFC draft (foudil-securitytxt-05). Key differentiators: supports repeating directives, inline comments (prefix, postfix, field-level), and array values for multiple contacts or policies. Lightweight—no external runtime dependencies; works with Express 4.x+. Safer alternatives exist (e.g., manual static file serving) if zero risk of misconfiguration is required.
npm install express-security-txtVerified import paths — ran on the pinned version, not inferred.
Sets up Express middleware to serve a security.txt policy at /.well-known/security.txt using the setup function with required contact and optional fields.
Use dynamic import() or convert project to ESM. CJS projects should stay on v3.x (3.1.1).
Use import { setup } from 'express-security-txt' instead of default import.Use camelCase keys as documented.
Always include a 'contact' option (string or array).
Upgrade Node.js to >=18 or use v3.x.
Add a separate route for /security.txt that redirects to /.well-known/security.txt.
Use dynamic import: const securityTxt = await import('express-security-txt'); or switch to ESM ("type": "module" in package.json).Import type from v4: import type { SecurityTxtOptions } from 'express-security-txt';Ensure options object is defined and contains at least 'contact' field: const options = { contact: '...' };Run npm install express-security-txt@latest. Check package.json for version.
No dependency data recorded yet.