fix(security): refuse compressed request bodies

express.json decompressed Content-Encoding br/gzip/deflate bodies before
the PIN check, running Node's Brotli decoder on input from anyone who
can reach the port (CVE-2026-111497). The app never sends compressed
bodies, so they now get 415.
This commit is contained in:
larssand committed 2026-10-22 13:19:59 +02:00
1 parent 4def444202
commit 3f7f62bfa8
3 files changed
+35 -1

No files matched your search

+3 -1
View File
@@ -136,7 +136,9 @@ const allowedCorsOrigins = new Set(
.filter(Boolean)
);
app.use(express.json({ limit: "20mb" }));
// inflate: false - the app never sends compressed bodies. Decompressing them ran Node's Brotli/zlib
// decoders on input from anyone who can reach the port, before the PIN check (CVE-2026-111497).
app.use(express.json({ limit: "20mb", inflate: false }));
app.use((req, res, next) => {
res.setHeader("X-Content-Type-Options", "nosniff");
res.setHeader("Referrer-Policy", "no-referrer");