Skip to content

Commit 57ebbdc

Browse files
nodejs-github-botaduh95
authored andcommitted
deps: update undici to 7.30.2
PR-URL: #67273 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Richard Lau <richard.lau@ibm.com>
1 parent 338f67f commit 57ebbdc

18 files changed

Lines changed: 1099 additions & 528 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# undici 7.30.2 security fixes
2+
3+
This release fixes six vulnerabilities.
4+
5+
## CVE-2026-116592 / GHSA-mqg3-3v4r-cm32 (high)
6+
7+
Undici 7.30.1 could cache the final response from a redirect chain under the original request key without applying the origin, cache policy, freshness, or `Vary` requirements of every intermediate hop. This could poison a cache or expose one user's response to another user. The fix validates every redirect hop, combines their `Vary` fields, limits freshness and stale serving to the most restrictive hop, and invalidates persistent SQLite entries written by vulnerable releases.
8+
9+
## CVE-2026-120474 / GHSA-7xg3-fphp-28hg (medium)
10+
11+
In Undici 7.x, a shared cache used with `compose(redirect(), cache())` could store a credential-dependent response from a same-origin redirect under the original URL. A later authenticated or unauthenticated request could then receive another user's response. Redirected requests carrying `Authorization`, `Cookie`, or `Proxy-Authorization` are no longer stored under the original alias key.
12+
13+
## CVE-2026-116630 / GHSA-5rm8-gv32-r954 (medium)
14+
15+
In Undici 7.x, a cross-origin redirect during cache revalidation could let a `304 Not Modified` response from the redirect target validate a cached response from the original origin. Undici now checks that the revalidation target matches the cached URL and that any returned validator matches the stored representation before replaying the cached body.
16+
17+
## CVE-2026-120415 / GHSA-9v6h-8rgp-m69f (medium)
18+
19+
In Undici 7.x, the redirect interceptor did not strip credentials correctly when request headers were supplied as an array of `[name, value]` pairs. With a header-normalizing interceptor outside `redirect()`, credentials could be sent to a cross-origin redirect target. Undici now handles both tuple arrays and flat header arrays when removing sensitive headers.
20+
21+
## CVE-2026-120222 / GHSA-3g9m-rv3r-w5w2 (medium)
22+
23+
In Undici 7.x, a downstream handler exception during cache replay could escape as an uncaught exception or unhandled promise rejection and terminate the process. This included `dump` size-limit failures, excessive `Content-Encoding` values in `decompress`, asynchronous cache-store failures, and cached-body replay after a `304`. These failures are now reported as request errors.
24+
25+
## CVE-2026-120423 / GHSA-r4pc-4jcp-7pqc (medium)
26+
27+
Undici 7.15.0 through 7.30.1 could skip Subresource Integrity verification when valid integrity metadata was separated or surrounded by ASCII whitespace other than a space, including a horizontal tab. Integrity metadata is now split on all ASCII whitespace before SHA-256, SHA-384, or SHA-512 verification.

‎deps/undici/src/lib/cache/sqlite-cache-store.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ const { assertCacheKey, assertCacheValue } = require('../util/cache.js')
55

66
let DatabaseSync
77

8-
const VERSION = 3
8+
// Bump when entries written by an older cache policy are unsafe to reuse.
9+
// Version 4 invalidates entries that may have been poisoned through redirects.
10+
const VERSION = 4
911

1012
// 2gb
1113
const MAX_ENTRY_SIZE = 2 * 1000 * 1000 * 1000

‎deps/undici/src/lib/core/request.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ class Request {
123123

124124
this.method = method
125125

126-
this.typeOfService = typeOfService ?? 0
126+
this.typeOfService = typeOfService
127127

128128
this.abort = null
129129

‎deps/undici/src/lib/core/util.js‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,26 @@ function parseRawHeaders (headers) {
507507
return ret
508508
}
509509

510+
/**
511+
* @param {Record<string, string | string[]>} headers
512+
* @returns {Buffer[]}
513+
*/
514+
function toRawHeaders (headers) {
515+
const rawHeaders = []
516+
517+
for (const [name, value] of Object.entries(headers)) {
518+
if (Array.isArray(value)) {
519+
for (const entry of value) {
520+
rawHeaders.push(Buffer.from(name, 'latin1'), Buffer.from(`${entry}`, 'latin1'))
521+
}
522+
} else {
523+
rawHeaders.push(Buffer.from(name, 'latin1'), Buffer.from(`${value}`, 'latin1'))
524+
}
525+
}
526+
527+
return rawHeaders
528+
}
529+
510530
/**
511531
* @param {string[]} headers
512532
* @param {Buffer[]} headers
@@ -961,6 +981,7 @@ module.exports = {
961981
removeAllListeners,
962982
errorRequest,
963983
parseRawHeaders,
984+
toRawHeaders,
964985
encodeRawHeaders,
965986
parseHeaders,
966987
parseKeepAliveTimeout,

‎deps/undici/src/lib/dispatcher/client-h1.js‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const removeAllListeners = util.removeAllListeners
6161
const kIdleSocketValidation = Symbol('kIdleSocketValidation')
6262
const kIdleSocketValidationTimeout = Symbol('kIdleSocketValidationTimeout')
6363
const kSocketUsed = Symbol('kSocketUsed')
64+
const kTypeOfService = Symbol('kTypeOfService')
6465

6566
let extractBody
6667

@@ -1109,6 +1110,32 @@ function shouldSendContentLength (method) {
11091110
return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT'
11101111
}
11111112

1113+
function setTypeOfService (socket, request) {
1114+
if (typeof socket.setTypeOfService !== 'function') {
1115+
return
1116+
}
1117+
1118+
const typeOfService = request.typeOfService
1119+
1120+
if (typeOfService === undefined) {
1121+
return
1122+
}
1123+
1124+
const currentTypeOfService = socket[kTypeOfService]
1125+
1126+
if (currentTypeOfService === typeOfService) {
1127+
return
1128+
}
1129+
1130+
try {
1131+
socket.setTypeOfService(typeOfService)
1132+
socket[kTypeOfService] = typeOfService
1133+
} catch {
1134+
// QoS marking is best-effort. setTypeOfService() can throw synchronously on
1135+
// some platforms depending on socket state, but that must not abort the request.
1136+
}
1137+
}
1138+
11121139
/**
11131140
* @param {import('./client.js')} client
11141141
* @param {import('../core/request.js')} request
@@ -1248,9 +1275,7 @@ function writeH1 (client, request) {
12481275
socket[kBlocking] = true
12491276
}
12501277

1251-
if (socket.setTypeOfService) {
1252-
socket.setTypeOfService(request.typeOfService)
1253-
}
1278+
setTypeOfService(socket, request)
12541279

12551280
let header = `${method} ${path} HTTP/1.1\r\n`
12561281

0 commit comments

Comments
 (0)