boxlang-express 0.2.20

Released .

Behavior changes below before upgrading.

  • Routing: skipping routes no longer recurses once per skipped layer. An app with ~550 routes and middleware overflowed the stack on any 404 (500 error); 3,000+ now work, and a 404 past 500 routes went from 258 ms to about 22 ms.
  • Static files: dotfiles are ignored by default (/.env was served); dotfiles: "deny" | "allow"; /.well-known/ always served. Added .mjs, .webp, .wasm, .map and other common types (ES modules were served as application/octet-stream).
  • Streamed file responses: res.sendFile(), res.download() and static files stream from disk instead of reading the whole file into memory per request (HEAD included). Range offsets past 2 GB were clamped to the same wrong position; fixed.
  • trust proxy takes a hop count or a list of proxy addresses/CIDRs, as in Express, so req.ip (and the rate-limit key) can't be picked by a client behind a proxy that appends to X-Forwarded-For. X-Forwarded-Proto/-Host are believed only from a trusted peer.
  • Cluster relay: secretKey (16+ characters) is now required to relay STOMP messages — an unset one used to leave /__cluster open to anyone who could reach the port. Compared in constant time, case-sensitively.
  • CSRF: the token is compared in constant time and case-sensitively (BoxLang's != is neither); a JSON array body no longer errors.
  • WebSockets: same-origin check on app.ws() handshakes, with { origins } per route and app.set("wsOrigins").
  • CORS: credentials: true with origin: true or "*" now throws; Vary: Origin is sent whenever the response depends on Origin.
  • Sessions: req.regenerateSession() for login; the in-memory store is capped by maxSessions (default 100,000) and sweeps expired entries at most every 30 seconds instead of scanning on every 100th write.
  • Uploads: the stored extension is kept only if alphanumeric and ≤10 characters, with a containment check on the written path. The parser copies part contents straight from the request bytes instead of making several whole-body copies.
  • Conditional GET: If-None-Match handles lists, *, and weak tags, and compares case-sensitively.
  • Removed Handlebars views (.hbs) and the vendored handlebars-4.3.1.jar, which carried an unrelated advisory.
  • Response builds its status and MIME tables once per class instead of per request.
  • Behavior changes:
    • .hbs views throw BoxExpress.UnsupportedViewEngine; convert them to .bxm.
    • Dotfiles under boxExpressStatic() are no longer served (use dotfiles: "allow" if you relied on it).
    • app.ws() refuses cross-site browser origins (use origins or app.set("wsOrigins", "*")).
    • A clustered STOMP broker won't start without a 16+ character secretKey.
    • boxExpressCors({ credentials: true }) without an explicit origin throws.
    • trust proxy: 1 (or any number) now means one hop, as in Express, not "trust everything".
  • Full suite: 403/403.