Skip to content

Commit 8c804cf

Browse files
[AUTO-CHERRYPICK] nodejs and python-tensorboard: patched vendor tarball to fix CVE-2024-21538 - branch 3.0-dev (#11195)
Co-authored-by: Bala <kumaran.4353@gmail.com>
1 parent a5e4135 commit 8c804cf

3 files changed

Lines changed: 47 additions & 2 deletions

File tree

SPECS/nodejs/CVE-2024-21538.patch

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From ea1368b332cebba727436bf4dddebb0c5d7a9d5b Mon Sep 17 00:00:00 2001
2+
From: bala <balakumaran.kannan@microsoft.com>
3+
Date: Tue, 19 Nov 2024 12:03:43 +0000
4+
Subject: [PATCH] Vendor patch applied to fix CVE-2024-21538
5+
6+
---
7+
deps/npm/node_modules/cross-spawn/lib/util/escape.js | 6 ++++--
8+
1 file changed, 4 insertions(+), 2 deletions(-)
9+
10+
diff --git a/deps/npm/node_modules/cross-spawn/lib/util/escape.js b/deps/npm/node_modules/cross-spawn/lib/util/escape.js
11+
index b0bb84c..e4804b9 100644
12+
--- a/deps/npm/node_modules/cross-spawn/lib/util/escape.js
13+
+++ b/deps/npm/node_modules/cross-spawn/lib/util/escape.js
14+
@@ -15,15 +15,17 @@ function escapeArgument(arg, doubleEscapeMetaChars) {
15+
arg = `${arg}`;
16+
17+
// Algorithm below is based on https://qntm.org/cmd
18+
+ // It's slightly altered to disable JS backtracking to avoid hanging on specially crafted input
19+
+ // Please see https://github.com/moxystudio/node-cross-spawn/pull/160 for more information
20+
21+
// Sequence of backslashes followed by a double quote:
22+
// double up all the backslashes and escape the double quote
23+
- arg = arg.replace(/(\\*)"/g, '$1$1\\"');
24+
+ arg = arg.replace(/(?=\\*?)"/g, '$1$1\\"');
25+
26+
// Sequence of backslashes followed by the end of the string
27+
// (which will become a double quote later):
28+
// double up all the backslashes
29+
- arg = arg.replace(/(\\*)$/, '$1$1');
30+
+ arg = arg.replace(/(?=\\*?)$/, '$1$1');
31+
32+
// All other backslashes occur literally
33+
34+
--
35+
2.39.4
36+

SPECS/nodejs/nodejs.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Name: nodejs
55
# WARNINGS: MUST check and update the 'npm_version' macro for every version update of this package.
66
# The version of NPM can be found inside the sources under 'deps/npm/package.json'.
77
Version: 20.14.0
8-
Release: 2%{?dist}
8+
Release: 3%{?dist}
99
License: BSD AND MIT AND Public Domain AND NAIST-2003 AND Artistic-2.0
1010
Vendor: Microsoft Corporation
1111
Distribution: Azure Linux
@@ -17,6 +17,7 @@ URL: https://github.com/nodejs/node
1717
Source0: https://nodejs.org/download/release/v%{version}/node-v%{version}.tar.xz
1818
Patch0: disable-tlsv1-tlsv1-1.patch
1919
Patch1: CVE-2019-10906.patch
20+
Patch2: CVE-2024-21538.patch
2021
BuildRequires: brotli-devel
2122
BuildRequires: c-ares-devel
2223
BuildRequires: coreutils >= 8.22
@@ -128,6 +129,9 @@ make cctest
128129
%{_prefix}/lib/node_modules/*
129130

130131
%changelog
132+
* Tue Nov 19 2024 Bala <balakumaran.kannan@microsoft.com> - 20.14.0-3
133+
- Patch CVE-2024-21538
134+
131135
* Thu Sep 19 2024 Suresh Thelkar <sthelkar@microsoft.com> - 20.14.0-2
132136
- Patch CVE-2019-10906
133137

SPECS/python-tensorboard/python-tensorboard.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ TensorBoard is a suite of web applications for inspecting and understanding your
77
Summary: TensorBoard is a suite of web applications for inspecting and understanding your TensorFlow runs and graphs
88
Name: python-%{pypi_name}
99
Version: 2.16.2
10-
Release: 5%{?dist}
10+
Release: 6%{?dist}
1111
License: ASL 2.0
1212
Vendor: Microsoft Corporation
1313
Distribution: Azure Linux
@@ -64,6 +64,7 @@ Summary: %{summary}
6464

6565
%prep
6666
%autosetup -p1 -n tensorboard-%{version}
67+
rm -rf tensorboard-%{version}/tb_tmp/b069b9e9814ff76ffa6219506d1f1e79/external/npm
6768

6869
%build
6970

@@ -97,6 +98,10 @@ mv %{pypi_name}-*.whl pyproject-wheeldir/
9798
%{python3_sitelib}/tensorboard_data_server*
9899

99100
%changelog
101+
* Tue Nov 19 2024 Bala <balakumaran.kannan@microsoft.com> - 2.16.2-6
102+
- Remove npm directory before building to make sure as no nodejs vulnerability is getting through
103+
- It is done while fixing CVE-2024-21538
104+
100105
* Thu Sep 26 09 2024 Rohit Rawat <rohitrawat@microsoft.com> - 2.16.2-5
101106
- Patch to fix CVE-2024-45590
102107

0 commit comments

Comments
 (0)