public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/nodejs22] f45: Backport pacote fix for CVE-2026-9496
@ 2026-10-30 11:24 Andrei Radchenko
  0 siblings, 0 replies; only message in thread
From: Andrei Radchenko @ 2026-10-30 11:24 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/nodejs22
            Branch : f45
            Commit : fe9183f9dc11408f5b375e0091881ae7368299ee
            Author : Andrei Radchenko <aradchen@redhat.com>
            Date   : 2026-10-30T12:24:29+01:00
            Stats  : +35/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/nodejs22/c/fe9183f9dc11408f5b375e0091881ae7368299ee?branch=f45

            Log:
            Backport pacote fix for CVE-2026-9496

Backports the upstream addGitSha fix (npm/pacote ce804fb) to the bundled
pacote 19.0.2. Replaces the ReDoS-prone `rawSpec.replace(/#.*$/, '')`
committish stripping with indexOf/slice, preventing denial of service via
a crafted spec.rawSpec value. The upstream fix ships in pacote 21.5.1,
which cannot be dropped into npm 10.9.9, so the change is backported.

Resolves: rhbz#2533203

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---
diff --git a/0001-npm-backport-pacote-fix-for-CVE-2026-9496.patch b/0001-npm-backport-pacote-fix-for-CVE-2026-9496.patch
new file mode 100644
index 0000000..62c592a
--- /dev/null
+++ b/0001-npm-backport-pacote-fix-for-CVE-2026-9496.patch
@@ -0,0 +1,34 @@
+From 373af361b9194dc8bfe4e80318bd273ec02a7c5a Mon Sep 17 00:00:00 2001
+From: Andrei Radchenko <aradchen@redhat.com>
+Date: Thu, 22 Oct 2026 15:02:43 +0200
+Subject: [PATCH] npm backport pacote fix for CVE-2026-9496
+
+---
+ deps/npm/node_modules/pacote/lib/util/add-git-sha.js | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/deps/npm/node_modules/pacote/lib/util/add-git-sha.js b/deps/npm/node_modules/pacote/lib/util/add-git-sha.js
+index 843fe5b6..39893b47 100644
+--- a/deps/npm/node_modules/pacote/lib/util/add-git-sha.js
++++ b/deps/npm/node_modules/pacote/lib/util/add-git-sha.js
+@@ -3,12 +3,15 @@ const addGitSha = (spec, sha) => {
+   if (spec.hosted) {
+     const h = spec.hosted
+     const opt = { noCommittish: true }
+-    const base = h.https && h.auth ? h.https(opt) : h.shortcut(opt)
++    const base = h.https && (h.auth || h.default === 'https') ? h.https(opt) : h.shortcut(opt)
+ 
+     return `${base}#${sha}`
+   } else {
+     // don't use new URL for this, because it doesn't handle scp urls
+-    return spec.rawSpec.replace(/#.*$/, '') + `#${sha}`
++    // strip the committish with indexOf/slice to avoid a regexp redos
++    const hashIndex = spec.rawSpec.indexOf('#')
++    const base = hashIndex === -1 ? spec.rawSpec : spec.rawSpec.slice(0, hashIndex)
++    return `${base}#${sha}`
+   }
+ }
+ 
+-- 
+2.56.0
+

diff --git a/nodejs22.spec b/nodejs22.spec
index 4c7dd18..02de06b 100644
--- a/nodejs22.spec
+++ b/nodejs22.spec
@@ -170,6 +170,7 @@ Source101:      nodejs.srpm.macros
 0001-npm-update-ip-address-to-10.7.4.patch
 0001-npm-update-brace-expansion-to-2.1.7.patch
 0001-deps-update-brace-expansion-to-5.0.12.patch
+0001-npm-backport-pacote-fix-for-CVE-2026-9496.patch
 0001-fix-build-with-shared-brotli.patch
 
 %description

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-30 11:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30 11:24 [rpms/nodejs22] f45: Backport pacote fix for CVE-2026-9496 Andrei Radchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox