Skip to content

Commit f0513d9

Browse files
authored
Patch CVE-2024-45590 in python-tensorboard (microsoft#10559)
1 parent 04d0fbc commit f0513d9

File tree

2 files changed

+92
-1
lines changed

2 files changed

+92
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
From 8007c86f9772612b795ddd2733ec8d8f7c9957b8 Mon Sep 17 00:00:00 2001
2+
From: Rohit Rawat <xordux@gmail.com>
3+
Date: Wed, 25 Sep 2024 17:14:58 +0000
4+
Subject: [PATCH] CVE-2024-45590: Set default depth limit to 32
5+
6+
---
7+
.../body-parser/lib/types/urlencoded.js | 37 +++++++++++++++----
8+
1 file changed, 30 insertions(+), 7 deletions(-)
9+
10+
diff --git a/tb_tmp/b069b9e9814ff76ffa6219506d1f1e79/external/npm/_/node_modules/body-parser/lib/types/urlencoded.js b/tb_tmp/b069b9e9814ff76ffa6219506d1f1e79/external/npm/_/node_modules/body-parser/lib/types/urlencoded.js
11+
index b2ca8f16d..886a3ce23 100644
12+
--- a/tb_tmp/b069b9e9814ff76ffa6219506d1f1e79/external/npm/_/node_modules/body-parser/lib/types/urlencoded.js
13+
+++ b/tb_tmp/b069b9e9814ff76ffa6219506d1f1e79/external/npm/_/node_modules/body-parser/lib/types/urlencoded.js
14+
@@ -55,6 +55,9 @@ function urlencoded (options) {
15+
: opts.limit
16+
var type = opts.type || 'application/x-www-form-urlencoded'
17+
var verify = opts.verify || false
18+
+ var depth = typeof opts.depth !== 'number'
19+
+ ? Number(opts.depth || 32)
20+
+ : opts.depth
21+
22+
if (verify !== false && typeof verify !== 'function') {
23+
throw new TypeError('option verify must be function')
24+
@@ -118,7 +121,8 @@ function urlencoded (options) {
25+
encoding: charset,
26+
inflate: inflate,
27+
limit: limit,
28+
- verify: verify
29+
+ verify: verify,
30+
+ depth: depth
31+
})
32+
}
33+
}
34+
@@ -133,12 +137,20 @@ function extendedparser (options) {
35+
var parameterLimit = options.parameterLimit !== undefined
36+
? options.parameterLimit
37+
: 1000
38+
+
39+
+ var depth = typeof options.depth !== 'number'
40+
+ ? Number(options.depth || 32)
41+
+ : options.depth
42+
var parse = parser('qs')
43+
44+
if (isNaN(parameterLimit) || parameterLimit < 1) {
45+
throw new TypeError('option parameterLimit must be a positive number')
46+
}
47+
48+
+ if(isNaN(depth) || depth < 0) {
49+
+ throw new TypeError('option depth must be a zero or a positive number')
50+
+ }
51+
+
52+
if (isFinite(parameterLimit)) {
53+
parameterLimit = parameterLimit | 0
54+
}
55+
@@ -156,12 +168,23 @@ function extendedparser (options) {
56+
var arrayLimit = Math.max(100, paramCount)
57+
58+
debug('parse extended urlencoding')
59+
- return parse(body, {
60+
- allowPrototypes: true,
61+
- arrayLimit: arrayLimit,
62+
- depth: Infinity,
63+
- parameterLimit: parameterLimit
64+
- })
65+
+ try {
66+
+ return parse(body, {
67+
+ allowPrototypes: true,
68+
+ arrayLimit: arrayLimit,
69+
+ depth: depth,
70+
+ strictDepth: true,
71+
+ parameterLimit: parameterLimit
72+
+ })
73+
+ } catch (err) {
74+
+ if (err instanceof RangeError) {
75+
+ throw createError(400, 'The input exceeded the depth', {
76+
+ type: 'querystring.parse.rangeError'
77+
+ })
78+
+ } else {
79+
+ throw err
80+
+ }
81+
+ }
82+
}
83+
}
84+
85+
--
86+
2.39.4
87+

SPECS/python-tensorboard/python-tensorboard.spec

+5-1
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: 4%{?dist}
10+
Release: 5%{?dist}
1111
License: ASL 2.0
1212
Vendor: Microsoft Corporation
1313
Distribution: Azure Linux
@@ -17,6 +17,7 @@ Source0: %{_distro_sources_url}/%{name}-%{version}.tar.gz#/%{name}-%{vers
1717
Patch0: 0000-Use-system-package.patch
1818
Patch1: CVE-2024-43788.patch
1919
Patch2: CVE-2024-43796.patch
20+
Patch3: CVE-2024-45590.patch
2021

2122
BuildRequires: bazel
2223
BuildRequires: build-essential
@@ -96,6 +97,9 @@ mv %{pypi_name}-*.whl pyproject-wheeldir/
9697
%{python3_sitelib}/tensorboard_data_server*
9798

9899
%changelog
100+
* Thu Sep 26 09 2024 Rohit Rawat <rohitrawat@microsoft.com> - 2.16.2-5
101+
- Patch to fix CVE-2024-45590
102+
99103
* Wed Sep 25 09 2024 Rohit Rawat <rohitrawat@microsoft.com> - 2.16.2-4
100104
- Patch to fix CVE-2024-43796
101105

0 commit comments

Comments
 (0)