Skip to content

Commit 1b5ced0

Browse files
authored
refactor(server): Update ws to address CVE (#22845)
## Description Updates dependencies to get to [email protected] (or [email protected]) to address https://nvd.nist.gov/vuln/detail/CVE-2024-37890. Updating socket.io to 4.8.0 was necessary in some cases get the necessary dependency ranges. socket.io 4.7.5-4.8.0 is a minor semver update but contains [a breaking change in the type of the `close()` function](https://github.com/socketio/socket.io/pull/4971/files), so two places had to be updated to account for that.
1 parent 4b8d1c5 commit 1b5ced0

File tree

10 files changed

+89
-124
lines changed

10 files changed

+89
-124
lines changed

server/gitrest/pnpm-lock.yaml

+15-28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/historian/pnpm-lock.yaml

+14-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/routerlicious/packages/memory-orderer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"lodash": "^4.17.21",
7676
"sillyname": "^0.1.0",
7777
"uuid": "^9.0.0",
78-
"ws": "^7.4.6"
78+
"ws": "^7.5.10"
7979
},
8080
"devDependencies": {
8181
"@fluid-tools/build-cli": "^0.38.0",

server/routerlicious/packages/routerlicious-base/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"sillyname": "^0.1.0",
8484
"uuid": "^9.0.0",
8585
"winston": "^3.6.0",
86-
"ws": "^7.4.6"
86+
"ws": "^7.5.10"
8787
},
8888
"devDependencies": {
8989
"@fluid-tools/build-cli": "^0.38.0",

server/routerlicious/packages/services-shared/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@
7272
"nconf": "^0.12.0",
7373
"notepack.io": "^2.3.0",
7474
"serialize-error": "^8.1.0",
75-
"socket.io": "^4.7.5",
76-
"socket.io-adapter": "^2.5.4",
75+
"socket.io": "^4.8.0",
76+
"socket.io-adapter": "^2.5.5",
7777
"socket.io-parser": "^4.2.4",
7878
"uuid": "^9.0.0",
7979
"winston": "^3.6.0"

server/routerlicious/packages/services-shared/src/socketIoServer.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,12 @@ class SocketIoServer implements core.IWebSocketServer {
321321
}
322322
}
323323

324-
this.io.close();
325-
await sleep(3000); // Give time for any disconnect handlers to execute before closing Redis resources
324+
await this.io.close();
325+
// Give time for any disconnect handlers to execute before closing Redis resources
326+
// Note: on 2024-10-18, with the update to [email protected], the close() call above became async.
327+
// Maybe this sleep can be removed now? Not familiar enough with server to try to do it.
328+
// See https://github.com/socketio/socket.io/pull/4971 for details on the change.
329+
await sleep(3000);
326330
await Promise.all([
327331
this.redisClientConnectionManagerForPub.getRedisClient().quit(),
328332
this.redisClientConnectionManagerForSub.getRedisClient().quit(),

server/routerlicious/packages/services/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"lru-cache": "^6.0.0",
7272
"mongodb": "4.17.1",
7373
"nconf": "^0.12.0",
74-
"socket.io": "^4.7.5",
74+
"socket.io": "^4.8.0",
7575
"telegrafjs": "^0.1.3",
7676
"uuid": "^9.0.0",
7777
"winston": "^3.6.0"

server/routerlicious/packages/tinylicious/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"lodash": "^4.17.21",
6666
"morgan": "^1.8.1",
6767
"nconf": "^0.12.0",
68-
"socket.io": "^4.7.5",
68+
"socket.io": "^4.8.0",
6969
"split": "^1.0.0",
7070
"uuid": "^9.0.0",
7171
"winston": "^3.6.0"

server/routerlicious/packages/tinylicious/src/services/webServerFactory.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ class SocketIoServer extends EventEmitter implements IWebSocketServer {
7070
});
7171
}
7272

73-
public async close(): Promise<void> {
74-
await new Promise<void>((resolve) => this.io.close(() => resolve()));
73+
public close(): Promise<void> {
74+
return this.io.close();
7575
}
7676
}
7777

0 commit comments

Comments
 (0)