Express 5.2
Last reviewed Sep 6, 2026
Prompt Details
Prompt Composition
3prompts
- JavaScript ES2026102 lines · 3.1K tokens
- Node.js 24101 lines · 5.3K tokens
- 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 proxydefaultfalseunless deployment topology is proven; avoid booleantrueand 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 onreq.ip,req.hostname, orreq.protocol. - Validate
req.hostnameagainst 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
limitto a finite byte count that you check at startup, rejecting anullor non-finitebytes.parse()result, because a malformed limit can switch size enforcement off;express.json(),raw(),text(), andurlencoded()default to100kbandinflate: true, and their limits count inflated bytes,