Skip to content

Missing security headers (ARCH3141)

Key typescript.security.missing-security-headers · Severity info · Category security · CWE CWE-693

Omitting key security headers such as CSP, X-Content-Type-Options, and HSTS leaves the app open to XSS, MIME-sniffing, and protocol-downgrade attacks. Add these headers by default.

import express from "express";
const app = express();
app.get("/", (req, res) => res.send(renderPage()));
import express from "express";
import helmet from "helmet";
const app = express();
app.use(helmet());
app.get("/", (req, res) => res.send(renderPage()));

Use a middleware like helmet to add CSP, HSTS, and X-Content-Type-Options headers to all HTML responses.