-
Notifications
You must be signed in to change notification settings - Fork 3.4k
chore(deps): update dependency ws to v8 [security] #32237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
See the guidelines for reviewing dependency updates for info on how to review dependency update PRs. |
3e3fc8e to
eeb4238
Compare
eeb4238 to
3b5292f
Compare
3b5292f to
aa93f36
Compare
aa93f36 to
5becd53
Compare
5becd53 to
c5c282d
Compare
c5c282d to
1cf8619
Compare
1cf8619 to
bedf656
Compare
bedf656 to
3e24fcb
Compare
6826617 to
4a940c2
Compare
4a940c2 to
79e4bbd
Compare
79e4bbd to
9cd56fd
Compare
| "tsconfig-paths": "3.10.1", | ||
| "webpack": "^5.88.2", | ||
| "ws": "5.2.4", | ||
| "ws": "8.17.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WebSocket message handlers expect strings but receive Buffers
High Severity
The upgrade from ws v5 to v8 introduces a breaking change where message data is now passed as Buffer objects instead of strings. The test files packages/server/test/integration/websockets_spec.js and system-tests/test/websockets_spec.js have message handlers that expect strings directly (e.g., expect(data).to.eq('response:foo') and template literals like response:${msg}), but will now receive Buffers. This causes test assertions to fail and incorrect message responses. The pattern used in cdp_spec.ts (calling .toString() on message data) is the correct approach for ws v8 compatibility, but these files weren't updated.
🔬 Verification Test
Why verification test was not possible: The bug manifests in test files that aren't part of the diff. However, the breaking change is documented in ws v8.0.0 release notes (confirmed via web search) which state "Text messages and close reasons are no longer decoded to strings. They are passed as Buffers." The existing code in websockets_spec.js files uses patterns like expect(data).to.eq('response:foo') and template literals ${msg} that assume string data, which will fail when data/msg are Buffers. The cdp_spec.ts file in the same codebase already uses the correct ws v8 pattern: JSON.parse(data.toString()).
Additional Locations (1)
| "tsconfig-paths": "3.10.1", | ||
| "webpack": "^5.88.2", | ||
| "ws": "5.2.4", | ||
| "ws": "8.17.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Server close cleanup fails on already-closed servers
Medium Severity
In ws v8, calling WebSocketServer.close() on an already-closed server now calls the callback with an error (this was a no-op before). In packages/server/test/integration/cdp_spec.ts, the closeWsServer() function rejects on any error, and afterEach calls it unconditionally. Tests like "retries up to 20 times" and "stops trying to reconnect if .close() is called" close the server mid-test without restarting it. When afterEach runs and calls closeWsServer() again, the promise will reject because the server is already closed, causing test cleanup failures.
🔬 Verification Test
Why verification test was not possible: This bug requires running the actual test suite with the upgraded ws v8 dependency. The behavioral change is documented in the ws v8.0.0 release notes: "The callback of WebSocketServer.prototype.close() is now called with an error if the server is already closed." The existing closeWsServer() function at line 84-97 of cdp_spec.ts rejects on error (if (err) { return reject(err) }), and afterEach at line 121 calls this without error handling, which will fail when the server was already closed during the test.
9cd56fd to
1f443ac
Compare
1f443ac to
03daf7b
Compare
This PR contains the following updates:
5.2.4→8.17.1GitHub Vulnerability Alerts
CVE-2021-32640
Impact
A specially crafted value of the
Sec-Websocket-Protocolheader can be used to significantly slow down a ws server.Proof of concept
Patches
The vulnerability was fixed in [email protected] (websockets/ws@00c425e) and backported to [email protected] (websockets/ws@78c676d) and [email protected] (websockets/ws@76d47c1).
Workarounds
In vulnerable versions of ws, the issue can be mitigated by reducing the maximum allowed length of the request headers using the
--max-http-header-size=sizeand/or themaxHeaderSizeoptions.Credits
The vulnerability was responsibly disclosed along with a fix in private by Robert McLaughlin from University of California, Santa Barbara.
CVE-2024-37890
Impact
A request with a number of headers exceeding the
server.maxHeadersCountthreshold could be used to crash a ws server.Proof of concept
Patches
The vulnerability was fixed in [email protected] (websockets/ws@e55e510) and backported to [email protected] (websockets/ws@22c2876), [email protected] (websockets/ws@eeb76d3), and [email protected] (websockets/ws@4abd8f6)
Workarounds
In vulnerable versions of ws, the issue can be mitigated in the following ways:
--max-http-header-size=sizeand/or themaxHeaderSizeoptions so that no more headers than theserver.maxHeadersCountlimit can be sent.server.maxHeadersCountto0so that no limit is applied.Credits
The vulnerability was reported by Ryan LaPointe in https://github.com/websockets/ws/issues/2230.
References
Release Notes
websockets/ws (ws)
v8.17.1Compare Source
Bug fixes
A request with a number of headers exceeding the
server.maxHeadersCountthreshold could be used to crash a ws server.
The vulnerability was reported by Ryan LaPointe in #2230.
In vulnerable versions of ws, the issue can be mitigated in the following ways:
--max-http-header-size=sizeand/or themaxHeaderSizeoptions sothat no more headers than the
server.maxHeadersCountlimit can be sent.server.maxHeadersCountto0so that no limit is applied.v8.17.0Compare Source
Features
WebSocketconstructor now accepts thecreateConnectionoption (#2219).Other notable changes
allowSynchronousEventsoption has been changed totrue(#2221).This is a breaking change in a patch release. The assumption is that the option
is not widely used.
v8.16.0Compare Source
Features
autoPongoption (01ba54e).v8.15.1Compare Source
Notable changes
allowMultipleEventsPerMicrotaskoption has been renamed toallowSynchronousEvents(4ed7fe5).This is a breaking change in a patch release that could have been avoided with
an alias, but the renamed option was added only 3 days ago, so hopefully it
hasn't already been widely used.
v8.15.0Compare Source
Features
allowMultipleEventsPerMicrotaskoption (93e3552).v8.14.2Compare Source
Bug fixes
swallowed when running tests (
7f4e1a7).v8.14.1Compare Source
Bug fixes
fd3c64c).v8.14.0Compare Source
Features
WebSocketconstructor now accepts HTTP(S) URLs (#2162).socketargument ofserver.handleUpgrade()can now be a genericDuplexstream (#2165).Other notable changes
v8.13.0Compare Source
Features
finishRequestoption to support late addition of headers (#2123).v8.12.1Compare Source
Bug fixes
browsercondition to package.json (#2118).v8.12.0Compare Source
Features
utf-8-validate@6(ff63bba).Other notable changes
buffer.isUtf8()is now used instead ofutf-8-validateif available(
42d79f6).v8.11.0Compare Source
Features
WebSocket.prototype.addEventListener()now supports an event listenerspecified as an object with a
handleEvent()method. (9ab743a).Bug fixes
WebSocket.prototype.addEventListener()now adds an event listener only if itis not already in the list of the event listeners for the specified event type
(
1cec17d).v8.10.0Compare Source
Features
211d5d3).v8.9.0Compare Source
Features
v8.8.1Compare Source
Bug fixes
AuthorizationandCookieheaders are no longer sent if the originalrequest for the opening handshake is sent to an IPC server and the client is
redirected to another IPC server (
bc8bd34).v8.8.0Compare Source
Features
WS_NO_BUFFER_UTILandWS_NO_UTF_8_VALIDATEenvironmentvariables (
becf237).v8.7.0Compare Source
Features
them with a custom HTTP response. (
6e5a5ce).Bug fixes
Upgradeheader field value in the HTTPresponse is not a case-insensitive match for the value "websocket" (
0fdcc0a).AuthorizationandCookieheaders are no longer sent when following aninsecure redirect (wss: to ws:) to the same host (
d68ba9e).v8.6.0Compare Source
Features
v8.5.0Compare Source
Features
WebSocketclass on the server (#2007).Bug fixes
AuthorizationandCookieheaders are nolonger sent if the redirect host is different from the original host (#2013).
v8.4.2Compare Source
Bug fixes
v8.4.1Compare Source
Notable changes
websocket.ping(),websocket.pong(), andwebsocket.send()are no longer converted toBuffers if the data does not need to be masked (#2000).v8.4.0Compare Source
Features
v8.3.0Compare Source
Features
WebSocket(0a8c7a9).Bug fixes
using the stream API (
ed2b803).redirect URL is invalid (#1980).
v8.2.3Compare Source
Bug fixes
is below the value of the
perMessageDeflate.thresholdoption (41ae563).v8.2.2Compare Source
Bug fixes
ec9377c).v8.2.1Compare Source
Bug fixes
from being closed cleanly (
869c989).v8.2.0Compare Source
Features
WebSocket.WebSocketas an alias forWebSocketandWebSocket.WebSocketServeras an alias forWebSocket.Serverto fix nameconsistency and improve interoperability with the ES module wrapper (#1935).
v8.1.0Compare Source
Features
Bug fixes
6a72da3).c95e695).v8.0.0Compare Source
Breaking changes
The
WebSocketconstructor now throws aSyntaxErrorif any of thesubprotocol names are invalid or duplicated (
0aecf0c).The server now aborts the opening handshake if an invalid
Sec-WebSocket-Protocolheader field value is received (1877dde).The
protocolsargument ofhandleProtocolshook is no longer anArraybuta
Set(1877dde).The opening handshake is now aborted if the
Sec-WebSocket-Extensionsheaderfield value is empty or it begins or ends with a white space (
e814110).Dropped support for Node.js < 10.0.0 (
552b506).The
WebSocketconstructor now throws aSyntaxErrorif the connection URLcontains a fragment identifier or if the URL's protocol is not one of
'ws:','wss:', or'ws+unix:'(ebea038).Text messages and close reasons are no longer decoded to strings. They are
passed as
Buffers to the listeners of their respective events. The listenersof the
'message'event now take a boolean argument specifying whether or notthe message is binary (
e173423).Existing code can be migrated by decoding the buffer explicitly.
The package now uses an ES module wrapper (
78adf5f).WebSocketServer.prototype.close()no longer closes existing connections(
df7de57).Existing code can be migrated by closing the connections manually.
The callback of
WebSocketServer.prototype.close()is now called with anerror if the server is already closed (
abde9cf).WebSocket.prototype.addEventListener()is now a noop if thetypeargumentis not one of
'close','error','message', or'open'(9558ed1).WebSocket.prototype.removeEventListener()now only removes listeners addedwith
WebSocket.prototype.addEventListener()and only one at time (ea95d9c).The value of the
onclose,onerror,onmessage, andonopenproperties isnow
nullif the respective event handler is not set (6756cf5).The
OpenEventclass has been removed (21e6500).Bug fixes
event listeners added with
WebSocket.prototype.addEventListener()(
0b21c03).v7.5.10Compare Source
Bug fixes
e55e510to the 7.x release line (22c2876).v7.5.9Compare Source
Bug fixes
bc8bd34to the 7.x release line (0435e6e).v7.5.8Compare Source
Bug fixes
0fdcc0ato the 7.x release line (2758ed3).d68ba9eto the 7.x release line (dc1781b).v7.5.7Compare Source
Bug fixes
6946f5fto the 7.x release line (1f72e2e).v7.5.6Compare Source
Bug fixes
b8186ddto the 7.x release line (73dec34).ed2b803to the 7.x release line (22a26af).v7.5.5Compare Source
Bug fixes
ec9377cto the 7.x release line (0e274ac).v7.5.4Compare Source
Bug fixes
6a72da3to the 7.x release line (76087fb).869c989to the 7.x release line (2799793).v7.5.3Compare Source
Bug fixes
WebSocketServerconstructor now throws an error if more than one of thenoServer,server, andportoptions are specefied (66e58d2).'close'event was emitted by aWebSocketServerbeforethe internal HTTP/S server was actually closed (
5a58730).WebSocketServer.prototype.close()was called (772236a).v7.5.2Compare Source
Bug fixes
Sec-WebSocket-Extensionsheader but no extension was requested or if theserver indicates an extension not requested by the client (
aca94c8).v7.5.1Compare Source
Bug fixes
error occurred simultaneously on both peers (
b434b9f).v7.5.0Compare Source
Features
codeproperty describing the specific type of errorthat has occurred (#1901).
Bug fixes
framing error) occurs (
8806aa9).connection is closed due to an error (
8806aa9).v7.4.6Compare Source
Bug fixes
00c425e).A specially crafted value of the
Sec-Websocket-Protocolheader could be usedto significantly slow down a ws server.
The vulnerability was responsibly disclosed along with a fix in private by
Robert McLaughlin from University of California, Santa Barbara.
In vulnerable versions of ws, the issue can be mitigated by reducing the maximum
allowed length of the request headers using the
--max-http-header-size=sizeand/or the
maxHeaderSizeoptions.v7.4.5Compare Source
Bug fixes
utf-8-validateis not installed(
23ba6b2).websocket.close()andwebsocket.terminate()didnot close the connection (
67e25ff).v7.4.4Compare Source
Bug fixes
permessage-deflate extension (
9277437).v7.4.3Compare Source
Bug fixes
takeover is disabled (#1840).
v7.4.2Compare Source
Bug fixes
a2c0d44).v7.4.1Compare Source
Bug fixes
'error'event bug in Node.js < 13 whichcaused an uncaught error during the WebSocket handshake (
38d6ab3).v7.4.0Compare Source
Features
WebSocketServer.prototype.handleUpgrade()now takes theclient HTTP GET request as second argument (
7d39f19).Bug fixes
eabed8f).CONNECTING,OPEN,CLOSING,CLOSED,binaryType,bufferedAmount,extensions,onclose,onerror,onmessage,onopen,protocol,readyState, andurlproperties are now enumerable (2069e68).v7.3.1Compare Source
Bug fixes
websocket.bufferedAmountaccuracy (e1349c0,a162942).v7.3.0Compare Source
Features
WebSocket.prototype.addEventListener()now supports theonceoption (#1754).v7.2.5Compare Source
Bug fixes
651d662).v7.2.3Compare Source
Bug fixes
WebSocket#{p{i,o}ng,close}()now thow an error if the data to send is toolarge to fit in a control frame (
e54f08d).v7.2.2Compare Source
Bug fixes
webSocketStream.end()could cause the processto crash (
9535702).or a masked frame is received on the client (#1681).
v7.2.1Compare Source
Bug fixes
bufferutilandutf-8-validateas peer dependencies (#1626).v7.2.0Compare Source
Features
readableObjectModeoption when usingWebSocket.createWebSocketStream()(#1647).v7.1.2Compare Source
Bug fixes
(#1618).
v7.1.1Compare Source
Bug fixes
WebSocketserver constructor is usedincorrectly (
3641266).v7.1.0Compare Source
Features
WebSocketin aDuplexstream (#1589).Bug fixes
ifstatement" (dbacf58, #1591).v7.0.1Compare Source
Bug fixes
v7.0.0Compare Source
Breaking changes
1e6999b).url.Urlinstances in theWebSocketconstructor(
692d7b4).WebSocket#{p{i,o}ng,send}()has changed when thereadyStateattribute is notOPEN(#1532)CONNECTING, an exception is thrown.CLOSINGorCLOSEDbufferedAmountattribute is increased by the length of thedataargument in bytes.
callbackfunction is called with an error.callbackfunction is not provided.v6.2.3Compare Source
Bug fixes
e55e510to the 6.x release line (eeb76d3).v6.2.2Compare Source
Bug fixes
00c425eto the 6.x release line (78c676d).v6.2.1Compare Source
Bug fixes
being set (
aa1dcd5).v6.2.0Compare Source
Features
Bug fixes
Sec-WebSocket-Keyheader fieldvalue is invalid (
160af45).v6.1.4Compare Source
Bug fixes
Hostheader to always include a port (#1510).v6.1.3Compare Source
Bug fixes
being parsed (#1494).
v6.1.2Compare Source
Bug fixes
26436e0).v6.1.1Compare Source
Bug fixes
and the socket closes prematurely (#1464, #1471).
v6.1.0Compare Source
Features
'close'event when the servercloses (#1453).
v6.0.0Compare Source
Breaking changes
d73885c).browser (#1345).
maxPayloadoption on the client. Defaults to 100 MiB (#1402).memLevelandleveloptions. UsezlibDeflateOptionsinstead. (80e2002).Configuration
📅 Schedule: Branch creation - "" in timezone America/New_York, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.