Skip to content

Commit 62c8d8f

Browse files
authored
Merge pull request #169 from meshtastic/fix/node2shell-brotli
Stop the Connect endpoint decoding Brotli request bodies (CVE-2026-111497)
2 parents df18004 + aa0a60b commit 62c8d8f

6 files changed

Lines changed: 13 additions & 4 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
# buffer.SlowBuffer is gone and the octokit -> jwa import chain throws on load, so the
4242
# server could not boot at all on the version CI was testing -- while the version we
4343
# actually ship was never exercised.
44-
node-version: "22"
44+
node-version-file: .nvmrc
4545

4646
- name: Install Dependencies
4747
run: pnpm install --ignore-scripts=false
@@ -65,7 +65,7 @@ jobs:
6565
# buffer.SlowBuffer is gone and the octokit -> jwa import chain throws on load, so the
6666
# server could not boot at all on the version CI was testing -- while the version we
6767
# actually ship was never exercised.
68-
node-version: "22"
68+
node-version-file: .nvmrc
6969

7070
- name: Install Dependencies
7171
run: pnpm install --ignore-scripts=false

‎.github/workflows/sync-maintenance-uf2.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Setup Node.js
3131
uses: actions/setup-node@v4
3232
with:
33-
node-version: "22"
33+
node-version-file: .nvmrc
3434

3535
- name: Install dependencies
3636
run: pnpm install --ignore-scripts=false

‎.nvmrc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22
1+
22.23.4

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@bufbuild/protobuf": "^1.7.2",
2929
"@connectrpc/connect": "^1.3.0",
3030
"@connectrpc/connect-express": "^1.3.0",
31+
"@connectrpc/connect-node": "^1.3.0",
3132
"@meshtastic/js": "2.2.23-0",
3233
"@octokit/auth-app": "^6.0.3",
3334
"@prisma/client": "5.22.0",

‎pnpm-lock.yaml‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/index.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { GatewayService } from "@buf/meshtastic_api.connectrpc_es/protobufs/gateway/v1/gateway_service_connect.js";
22
import { expressConnectMiddleware } from "@connectrpc/connect-express";
3+
import { compressionGzip } from "@connectrpc/connect-node";
34
import { App } from "@tinyhttp/app";
45
import { cors } from "@tinyhttp/cors";
56
import { config } from "@tinyhttp/dotenv";
@@ -84,6 +85,10 @@ app
8485
router.service(GatewayService, new Gateway());
8586
},
8687
connect: true,
88+
// gzip only. Left unset, this also accepts br on all three protocols, which hands any
89+
// client's request bytes to Node's bundled Brotli decoder -- the decoder CVE-2026-111497
90+
// (Node2Shell) writes out of bounds in. Nothing calls this service with compressed requests.
91+
acceptCompression: [compressionGzip],
8792
// @ts-expect-error
8893
})(req, res, next);
8994
});

0 commit comments

Comments
 (0)