Express 5.2

Last reviewed Sep 6, 2026

Export as PDF

Prompt Details

Prompt Composition

3prompts
  1. JavaScript ES2026102 lines · 3.1K tokens
  2. Node.js 24101 lines · 5.3K tokens
  3. Express 5.265 lines · 2.4K tokens
Total268 lines · 10.8K tokens

CWE Coverage

  • 20
  • 22
  • 59
  • 78
  • 79
  • 88
  • 89
  • 95
  • 113
  • 117
  • 201
  • 208
  • 209
  • 214
  • 250
  • 295
  • 297
  • 307
  • 319
  • 323
  • 330
  • 338
  • 346
  • 347
  • 352
  • 354
  • 362
  • 367
  • 377
  • 384
  • 426
  • 434
  • 444
  • 459
  • 471
  • 488
  • 494
  • 502
  • 524
  • 532
  • 552
  • 601
  • 602
  • 613
  • 614
  • 639
  • 653
  • 732
  • 770
  • 807
  • 829
  • 838
  • 862
  • 863
  • 908
  • 915
  • 916
  • 918
  • 922
  • 942
  • 943
  • 1004
  • 1321
  • 1333

Prompt Preview

Apply the Node.js 24 and JavaScript ES2026 prompts first. When the application uses Mongoose, Prisma, Drizzle ORM, Sequelize, or TypeORM, also apply the prompt for its installed version. These rules cover Express 5.2 proxy trust, routing, parsers, middleware order, sessions, browser boundaries, files, errors, and production deployment.

Proxy and request trust

  • Keep the trust proxy default false unless deployment topology is proven; avoid boolean true and numeric hop counts when clients can reach the app through shorter paths, and prefer exact proxy subnets or a reviewed function.
  • Do not trust X-Forwarded-* values from direct clients or proxies outside the configured boundary; require the trusted ingress proxy to remove or overwrite client-supplied forwarding headers before relying on req.ip, req.hostname, or req.protocol.
  • Validate req.hostname against exact production hosts before using it for links, tenant routing, or security decisions.
  • Treat path parameters, query values, body properties, headers, cookies, and files as separate untrusted namespaces.
  • Reject ambiguous duplicate security-sensitive values instead of relying on parser-dependent selection.

Parsers and request limits

  • Install only the body parsers each route needs and set limit to a finite byte count that you check at startup, rejecting a null or non-finite bytes.parse() result, because a malformed limit can switch size enforcement off; express.json(), raw(), text(), and urlencoded() default to 100kb and inflate: true, and their limits count inflated bytes,