From fa1d840682ed934314e837b807c2a3449c569798 Mon Sep 17 00:00:00 2001 From: flakey5 <73616808+flakey5@users.noreply.github.com> Date: Wed, 15 Jan 2025 22:51:18 -0800 Subject: [PATCH 1/3] Fix typo in update cache tests action (#4008) Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com> --- .github/workflows/update-cache-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-cache-tests.yml b/.github/workflows/update-cache-tests.yml index 267ea7a626b..317aa5f8453 100644 --- a/.github/workflows/update-cache-tests.yml +++ b/.github/workflows/update-cache-tests.yml @@ -33,7 +33,7 @@ jobs: mv test/fixtures/tmp-cache-tests/test-engine test/fixtures/cache-tests/test-engine && mv test/fixtures/tmp-cache-tests/results test/fixtures/cache-tests/results && - rm -rf tests/fixtures/tmp-cache-tests/ + rm -rf test/fixtures/tmp-cache-tests/ - name: Create Pull Request uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6 From c2d78cd19fe4f4c621424491e26ce299e65e934a Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Thu, 16 Jan 2025 10:13:25 +0100 Subject: [PATCH 2/3] Merge commit from fork * Use crypto.randomInt() Signed-off-by: Matteo Collina * fixup Signed-off-by: Matteo Collina --------- Signed-off-by: Matteo Collina --- lib/web/fetch/body.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/web/fetch/body.js b/lib/web/fetch/body.js index b092b3c83db..850a37fd801 100644 --- a/lib/web/fetch/body.js +++ b/lib/web/fetch/body.js @@ -17,6 +17,14 @@ const { isErrored, isDisturbed } = require('node:stream') const { isArrayBuffer } = require('node:util/types') const { serializeAMimeType } = require('./data-url') const { multipartFormDataParser } = require('./formdata-parser') +let random + +try { + const crypto = require('node:crypto') + random = (max) => crypto.randomInt(0, max) +} catch { + random = (max) => Math.floor(Math.random(max)) +} const textEncoder = new TextEncoder() function noop () {} @@ -110,7 +118,7 @@ function extractBody (object, keepalive = false) { // Set source to a copy of the bytes held by object. source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength)) } else if (webidl.is.FormData(object)) { - const boundary = `----formdata-undici-0${`${Math.floor(Math.random() * 1e11)}`.padStart(11, '0')}` + const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}` const prefix = `--${boundary}\r\nContent-Disposition: form-data` /*! formdata-polyfill. MIT License. Jimmy Wärting */ From 83537aa55028bfeef5dd9504abfde63264c2df5d Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Thu, 16 Jan 2025 10:13:56 +0100 Subject: [PATCH 3/3] Bumped v7.2.3 Signed-off-by: Matteo Collina --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 390017dee83..fce2115da7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "undici", - "version": "7.2.2", + "version": "7.2.3", "description": "An HTTP/1.1 client, written from scratch for Node.js", "homepage": "https://undici.nodejs.org", "bugs": {