Skip to content

Commit eede80b

Browse files
Bump curl, openssl, zlib to address CVEs (#482)
- openssl 3.1.4 -> 3.5.0 - zlib 1.3 -> 1.3.1 - curl 8.4.0 -> 8.13.0 Keep the `protobuf` to an old version (3.21.12) because it's the last release that supports C++11, see https://protobuf.dev/news/2022-08-03/ Keep the `asio` version not changed (1.28.2) because there are some APIs removed.
1 parent f37bf92 commit eede80b

File tree

10 files changed

+82
-33
lines changed

10 files changed

+82
-33
lines changed

.github/workflows/ci-pr-validation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
strategy:
4949
matrix:
5050
# TODO: support build on macos-14
51-
os: [ubuntu-20.04]
51+
os: [ubuntu-latest]
5252

5353
steps:
5454
- name: checkout

lib/HTTPLookupService.cc

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "CurlWrapper.h"
2727
#include "ExecutorService.h"
2828
#include "Int64SerDes.h"
29+
#include "JsonUtils.h"
2930
#include "LogUtils.h"
3031
#include "NamespaceName.h"
3132
#include "SchemaUtils.h"
@@ -409,15 +410,8 @@ void HTTPLookupService::handleGetSchemaHTTPRequest(GetSchemaPromise promise, con
409410
promise.setFailed(ResultInvalidMessage);
410411
return;
411412
}
412-
std::stringstream keyStream;
413-
ptree::write_json(keyStream, kvRoot.get_child("key"), false);
414-
std::stringstream valueStream;
415-
ptree::write_json(valueStream, kvRoot.get_child("value"), false);
416-
auto keyData = keyStream.str();
417-
auto valueData = valueStream.str();
418-
// Remove the last line break.
419-
keyData.pop_back();
420-
valueData.pop_back();
413+
const auto keyData = toJson(kvRoot.get_child("key"));
414+
const auto valueData = toJson(kvRoot.get_child("value"));
421415
schemaData = mergeKeyValueSchema(keyData, valueData);
422416
}
423417

lib/JsonUtils.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
#pragma once
20+
21+
#include <boost/property_tree/json_parser.hpp>
22+
#include <sstream>
23+
#include <string>
24+
25+
namespace pulsar {
26+
27+
template <typename Ptree>
28+
inline std::string toJson(const Ptree& pt) {
29+
std::ostringstream oss;
30+
boost::property_tree::write_json(oss, pt, false);
31+
// For Boost < 1.86, boost::property_tree will write a endline at the end
32+
#if BOOST_VERSION < 108600
33+
auto s = oss.str();
34+
s.pop_back();
35+
return s;
36+
#else
37+
return oss.str();
38+
#endif
39+
}
40+
41+
} // namespace pulsar

lib/Schema.cc

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
#include <map>
2626
#include <memory>
2727

28+
#include "JsonUtils.h"
2829
#include "SchemaUtils.h"
2930

3031
using boost::property_tree::ptree;
31-
using boost::property_tree::read_json;
32-
using boost::property_tree::write_json;
3332

3433
PULSAR_PUBLIC std::ostream &operator<<(std::ostream &s, pulsar::SchemaType schemaType) {
3534
return s << strSchemaType(schemaType);
@@ -170,11 +169,7 @@ SchemaInfo::SchemaInfo(const SchemaInfo &keySchema, const SchemaInfo &valueSchem
170169
for (auto &entry : properties) {
171170
pt.put(entry.first, entry.second);
172171
}
173-
std::ostringstream buf;
174-
write_json(buf, pt, false);
175-
auto s = buf.str();
176-
s.pop_back();
177-
return s;
172+
return toJson(pt);
178173
};
179174

180175
StringMap properties;

perf/PerfConsumer.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <lib/LogUtils.h>
2020
DECLARE_LOG_OBJECT()
2121

22+
// Don't remove this line because p_square_quantile.hpp requires including <algorithm> on some platforms
23+
#include <algorithm>
2224
#include <chrono>
2325
#include <fstream>
2426
#include <functional>

perf/PerfProducer.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <lib/LogUtils.h>
2020
DECLARE_LOG_OBJECT()
2121

22+
// Don't remove this line because p_square_quantile.hpp requires including <algorithm> on some platforms
23+
#include <algorithm>
2224
#include <boost/accumulators/accumulators.hpp>
2325
#include <boost/accumulators/statistics/mean.hpp>
2426
#include <boost/accumulators/statistics/p_square_quantile.hpp>

pkg/mac/build-static-library.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ git commit -m "Update version"
4848
COMMIT_ID=$(git log --pretty=oneline | head -n 1 | awk '{print $1}')
4949
cd ..
5050
sed -i.bak "s/.*builtin-baseline.*/ \"builtin-baseline\": \"$COMMIT_ID\",/" vcpkg.json
51-
sed -i.bak "s/\"version>=\": \"8\.4\.0\"/\"version>=\": \"8.4.0#1\"/" vcpkg.json
51+
sed -i.bak "s/\"version>=\": \"8\.13\.0#1\"/\"version>=\": \"8.13.0#2\"/" vcpkg.json
5252

5353
INSTALL_DIR=$PWD/pkg/mac/.install
5454
set -x

pkg/mac/vcpkg-curl-patch.diff

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake
2-
index bdc544e9e..340d93865 100644
2+
index 427bccb217..ddfd75d30f 100644
33
--- a/ports/curl/portfile.cmake
44
+++ b/ports/curl/portfile.cmake
5-
@@ -64,6 +64,10 @@ if(VCPKG_TARGET_IS_WINDOWS)
5+
@@ -62,6 +62,10 @@ if(VCPKG_TARGET_IS_WINDOWS)
66
list(APPEND OPTIONS -DENABLE_UNICODE=ON)
77
endif()
88

99
+if(VCPKG_TARGET_IS_OSX)
1010
+ list(APPEND OPTIONS -DENABLE_IPV6=OFF)
1111
+endif()
1212
+
13+
vcpkg_find_acquire_program(PKGCONFIG)
14+
1315
vcpkg_cmake_configure(
14-
SOURCE_PATH "${SOURCE_PATH}"
15-
OPTIONS
1616
diff --git a/ports/curl/vcpkg.json b/ports/curl/vcpkg.json
17-
index e028d3897..a63858e34 100644
17+
index 31955859d0..50e619b846 100644
1818
--- a/ports/curl/vcpkg.json
1919
+++ b/ports/curl/vcpkg.json
20-
@@ -1,6 +1,7 @@
20+
@@ -1,7 +1,7 @@
2121
{
2222
"name": "curl",
23-
"version": "8.4.0",
24-
+ "port-version": 1,
23+
"version": "8.13.0",
24+
- "port-version": 1,
25+
+ "port-version": 2,
2526
"description": "A library for transferring data with URLs",
2627
"homepage": "https://curl.se/",
2728
"license": "curl AND ISC AND BSD-3-Clause",

vcpkg

Submodule vcpkg updated 7950 files

vcpkg.json

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "pulsar-cpp",
3-
"version": "3.5.0",
3+
"version": "3.8.0",
44
"description": "Pulsar C++ SDK",
5-
"builtin-baseline": "b051745c68faa6f65c493371d564c4eb8af34dad",
5+
"builtin-baseline": "d6995a0cf3cafda5e9e52749fad075dd62bfd90c",
66
"dependencies": [
77
{
88
"name": "asio",
@@ -15,6 +15,10 @@
1515
"name": "boost-accumulators",
1616
"version>=": "1.83.0"
1717
},
18+
{
19+
"name": "boost-format",
20+
"version>=": "1.83.0"
21+
},
1822
{
1923
"name": "boost-property-tree",
2024
"version>=": "1.83.0"
@@ -25,15 +29,15 @@
2529
"features": [
2630
"openssl"
2731
],
28-
"version>=": "8.4.0"
32+
"version>=": "8.13.0#1"
2933
},
3034
{
3135
"name": "dlfcn-win32",
3236
"platform": "windows"
3337
},
3438
{
3539
"name": "openssl",
36-
"version>=": "3.1.4#1"
40+
"version>=": "3.5.0"
3741
},
3842
{
3943
"name": "protobuf",
@@ -45,7 +49,7 @@
4549
},
4650
{
4751
"name": "zlib",
48-
"version>=": "1.3"
52+
"version>=": "1.3.1"
4953
},
5054
{
5155
"name": "zstd",
@@ -71,5 +75,15 @@
7175
}
7276
]
7377
}
74-
}
78+
},
79+
"overrides": [
80+
{
81+
"name": "asio",
82+
"version": "1.28.2"
83+
},
84+
{
85+
"name": "protobuf",
86+
"version": "3.21.12"
87+
}
88+
]
7589
}

0 commit comments

Comments
 (0)