Jersson G Arrivasplata Rojas
TipSeguridadNode.js1 min de lecturaActualizado 2026

Configuraciones de seguridad por defecto

A05:2021 — Configuración incorrecta de seguridad

helmet() activa por defecto, entre otros, Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options: nosniff y X-Frame-Options, y elimina X-Powered-By.

javascript
const helmet = require("helmet");

app.use(helmet());

// Ajustes explícitos cuando los necesites
app.use(helmet.frameguard({ action: "deny" }));
app.use(helmet.hsts({ maxAge: 31536000, includeSubDomains: true }));

Para respuestas con datos sensibles, desactiva la caché con una cabecera propia.

javascript
app.use("/api", (req, res, next) => {
  res.set("Cache-Control", "no-store");
  next();
});

Actualizado 2026. helmet.noCache() e helmet.iexss() ya no existen en las versiones actuales de helmet. El filtro XSS de los navegadores antiguos está obsoleto; helmet ahora envía X-XSS-Protection: 0 de forma intencional.

Jersson G. Arrivasplata RojasSoftware Engineer & Technical Leader · Lima, Perú
TipSecurityNode.js1 min readUpdated 2026

Default security settings

A05:2021 — Security misconfiguration

By default helmet() enables, among others, Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options: nosniff and X-Frame-Options, and removes X-Powered-By.

javascript
const helmet = require("helmet");

app.use(helmet());

// Ajustes explícitos cuando los necesites
app.use(helmet.frameguard({ action: "deny" }));
app.use(helmet.hsts({ maxAge: 31536000, includeSubDomains: true }));

For responses with sensitive data, disable caching with your own header.

javascript
app.use("/api", (req, res, next) => {
  res.set("Cache-Control", "no-store");
  next();
});

Updated 2026. helmet.noCache() and helmet.iexss() no longer exist in current versions of helmet. The XSS filter of old browsers is obsolete; helmet now sends X-XSS-Protection: 0 on purpose.

Original post
Jersson G. Arrivasplata RojasSoftware Engineer & Technical Leader · Lima, Perú
TipSegurançaNode.js1 min de leituraAtualizado 2026

Configurações de segurança padrão

A05:2021 — Configuração incorreta de segurança

Por padrão, helmet() ativa, entre outros, Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options: nosniff e X-Frame-Options, e remove X-Powered-By.

javascript
const helmet = require("helmet");

app.use(helmet());

// Ajustes explícitos cuando los necesites
app.use(helmet.frameguard({ action: "deny" }));
app.use(helmet.hsts({ maxAge: 31536000, includeSubDomains: true }));

Para respostas com dados sensíveis, desative o cache com um cabeçalho próprio.

javascript
app.use("/api", (req, res, next) => {
  res.set("Cache-Control", "no-store");
  next();
});

Atualizado 2026. helmet.noCache() e helmet.iexss() não existem mais nas versões atuais do helmet. O filtro XSS dos navegadores antigos está obsoleto; o helmet agora envia X-XSS-Protection: 0 de propósito.

Jersson G. Arrivasplata RojasSoftware Engineer & Technical Leader · Lima, Perú

Apoya mis proyectos

Si una librería, guía o recurso de este sitio te fue útil, puedes aportar con Yape o Plin. Ayuda a mantener el código abierto y la documentación.

987 347 691Jersson G. Arrivasplata Rojas · Soles