Skip to content

Commit a63e937

Browse files
mcollinaRafaelGSS
authored andcommittedJan 19, 2025
deps: update undici to v5.28.5
Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: nodejs-private/node-private#657 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> CVE-ID: CVE-2025-22150
1 parent da2d177 commit a63e937

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed
 

‎deps/undici/src/lib/fetch/body.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ const { isUint8Array, isArrayBuffer } = require('util/types')
2222
const { File: UndiciFile } = require('./file')
2323
const { parseMIMEType, serializeAMimeType } = require('./dataURL')
2424

25+
let random
26+
try {
27+
const crypto = require('node:crypto')
28+
random = (max) => crypto.randomInt(0, max)
29+
} catch {
30+
random = (max) => Math.floor(Math.random(max))
31+
}
32+
2533
let ReadableStream = globalThis.ReadableStream
2634

2735
/** @type {globalThis['File']} */
@@ -107,7 +115,7 @@ function extractBody (object, keepalive = false) {
107115
// Set source to a copy of the bytes held by object.
108116
source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength))
109117
} else if (util.isFormDataLike(object)) {
110-
const boundary = `----formdata-undici-0${`${Math.floor(Math.random() * 1e11)}`.padStart(11, '0')}`
118+
const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
111119
const prefix = `--${boundary}\r\nContent-Disposition: form-data`
112120

113121
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */

‎deps/undici/src/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "undici",
3-
"version": "5.28.4",
3+
"version": "5.28.5",
44
"description": "An HTTP/1.1 client, written from scratch for Node.js",
55
"homepage": "https://undici.nodejs.org",
66
"bugs": {

‎deps/undici/undici.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -5241,6 +5241,13 @@ var require_body = __commonJS({
52415241
var { isUint8Array, isArrayBuffer } = require("util/types");
52425242
var { File: UndiciFile } = require_file();
52435243
var { parseMIMEType, serializeAMimeType } = require_dataURL();
5244+
var random;
5245+
try {
5246+
const crypto = require("node:crypto");
5247+
random = /* @__PURE__ */ __name((max) => crypto.randomInt(0, max), "random");
5248+
} catch {
5249+
random = /* @__PURE__ */ __name((max) => Math.floor(Math.random(max)), "random");
5250+
}
52445251
var ReadableStream = globalThis.ReadableStream;
52455252
var File = NativeFile ?? UndiciFile;
52465253
var textEncoder = new TextEncoder();
@@ -5283,7 +5290,7 @@ var require_body = __commonJS({
52835290
} else if (ArrayBuffer.isView(object)) {
52845291
source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength));
52855292
} else if (util.isFormDataLike(object)) {
5286-
const boundary = `----formdata-undici-0${`${Math.floor(Math.random() * 1e11)}`.padStart(11, "0")}`;
5293+
const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, "0")}`;
52875294
const prefix = `--${boundary}\r
52885295
Content-Disposition: form-data`;
52895296
const escape = /* @__PURE__ */ __name((str) => str.replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22"), "escape");

‎src/undici_version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
// Refer to tools/update-undici.sh
33
#ifndef SRC_UNDICI_VERSION_H_
44
#define SRC_UNDICI_VERSION_H_
5-
#define UNDICI_VERSION "5.28.4"
5+
#define UNDICI_VERSION "5.28.5"
66
#endif // SRC_UNDICI_VERSION_H_

0 commit comments

Comments
 (0)