GeezerVison is showing github.com — deps: update undici to 7.30.2 · nodejs/node@792f0d7
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +27Lines changed: 27 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 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. |
Collapse file Copy file name to clipboardExpand all lines: deps/undici/src/lib/cache/sqlite-cache-store.js +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,9 @@ const { assertCacheKey, assertCacheValue } = require('../util/cache.js') | 5 | 5 |
| 6 | 6 | let DatabaseSync | 7 | 7 |
| 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 | 9 | 11 |
| 10 | 12 | // 2gb | 11 | 13 | const MAX_ENTRY_SIZE = 2 * 1000 * 1000 * 1000 | |
Collapse file Copy file name to clipboardExpand all lines: deps/undici/src/lib/core/request.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -123,7 +123,7 @@ class Request { | 123 | 123 |
| 124 | 124 | this.method = method | 125 | 125 |
| 126 | | - this.typeOfService = typeOfService ?? 0 | | 126 | + this.typeOfService = typeOfService | 127 | 127 |
| 128 | 128 | this.abort = null | 129 | 129 |
| |
Collapse file Copy file name to clipboardExpand all lines: deps/undici/src/lib/core/util.js +21Lines changed: 21 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -507,6 +507,26 @@ function parseRawHeaders (headers) { | 507 | 507 | return ret | 508 | 508 | } | 509 | 509 |
| | 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 | + | 510 | 530 | /** | 511 | 531 | * @param {string[]} headers | 512 | 532 | * @param {Buffer[]} headers | @@ -961,6 +981,7 @@ module.exports = { | 961 | 981 | removeAllListeners, | 962 | 982 | errorRequest, | 963 | 983 | parseRawHeaders, | | 984 | + toRawHeaders, | 964 | 985 | encodeRawHeaders, | 965 | 986 | parseHeaders, | 966 | 987 | parseKeepAliveTimeout, | |
Collapse file Copy file name to clipboardExpand all lines: deps/undici/src/lib/dispatcher/client-h1.js +28-3Lines changed: 28 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -61,6 +61,7 @@ const removeAllListeners = util.removeAllListeners | 61 | 61 | const kIdleSocketValidation = Symbol('kIdleSocketValidation') | 62 | 62 | const kIdleSocketValidationTimeout = Symbol('kIdleSocketValidationTimeout') | 63 | 63 | const kSocketUsed = Symbol('kSocketUsed') | | 64 | +const kTypeOfService = Symbol('kTypeOfService') | 64 | 65 |
| 65 | 66 | let extractBody | 66 | 67 |
| @@ -1109,6 +1110,32 @@ function shouldSendContentLength (method) { | 1109 | 1110 | return method !== 'GET' && method !== 'HEAD' && method !== 'OPTIONS' && method !== 'TRACE' && method !== 'CONNECT' | 1110 | 1111 | } | 1111 | 1112 |
| | 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 | + | 1112 | 1139 | /** | 1113 | 1140 | * @param {import('./client.js')} client | 1114 | 1141 | * @param {import('../core/request.js')} request | @@ -1248,9 +1275,7 @@ function writeH1 (client, request) { | 1248 | 1275 | socket[kBlocking] = true | 1249 | 1276 | } | 1250 | 1277 |
| 1251 | | - if (socket.setTypeOfService) { | 1252 | | - socket.setTypeOfService(request.typeOfService) | 1253 | | - } | | 1278 | + setTypeOfService(socket, request) | 1254 | 1279 |
| 1255 | 1280 | let header = `${method} ${path} HTTP/1.1\r\n` | 1256 | 1281 |
| |
|