Skip to content

Commit 923e8e4

Browse files
authored
fix: rebuild libmongoc with SecureTransport for MongoDB Atlas TLS (#485)
* fix: rebuild libmongoc with SecureTransport for MongoDB Atlas TLS * Update project.pbxproj * fix: add changelog entry and SecureTransport deprecation note
1 parent fb75527 commit 923e8e4

5 files changed

Lines changed: 34 additions & 80 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Confirmation dialogs for deep link queries, connection imports, and pre-connect scripts
1313

14+
### Fixed
15+
16+
- MongoDB Atlas connections failing with "TLS certificate verify failed" due to missing CA bundle
17+
1418
## [0.25.0] - 2026-03-27
1519

1620
### Added

Libs/checksums.sha256

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
064606d4c05f60a73b7bed9574f703d56effde6006a0ada4a660e00e0949bbeb Libs/libbson_arm64.a
2-
0f05902d61adec1359c94f12c9bc7a1ceac86f4b492e2d6c02411a5926a0d728 Libs/libbson_universal.a
3-
2b21d294ed199e46949dfb29d229399d5345c256c39ed07b94a974890fcf5110 Libs/libbson_x86_64.a
4-
0f05902d61adec1359c94f12c9bc7a1ceac86f4b492e2d6c02411a5926a0d728 Libs/libbson.a
1+
36e3a521b8da03bafd0f943c4f3b21c8c573bf9d640c6c9e764c0c3632672849 Libs/libbson_arm64.a
2+
b7716e3f295a54feee85c8771332505be2f9a4a430a088d476d60e358d737c9e Libs/libbson_universal.a
3+
1e502e7fb4edc79639140e18d433a1ed1be2931162daecee71a74d09e9f4c550 Libs/libbson_x86_64.a
4+
b7716e3f295a54feee85c8771332505be2f9a4a430a088d476d60e358d737c9e Libs/libbson.a
55
8d7e31145470a339f4f57930831936db30412393a339598deece6f650214865a Libs/libcassandra_arm64.a
66
9bfd7d7cb4a7ee9823b4c5141e942a8534de63395983388722dc7c98e5d7731e Libs/libcassandra_universal.a
77
7f1d058c77b66273db2b3867103c19f62ed0518fb38611b178ce04029213d5d8 Libs/libcassandra_x86_64.a
@@ -26,10 +26,10 @@ b777f7a42766fb08c8e67b2310c67d2d463d77d3554c6092221c3352778622b2 Libs/libmariad
2626
5326ed729b287ae5dbbcf073aaa70dce29a73c7431e446d5958271af19dac8d8 Libs/libmariadb_universal.a
2727
4f7bbb3d73be178d4211c3bd5b2726b4a12db8b808eaa5212bf8e9eb3c570814 Libs/libmariadb_x86_64.a
2828
5326ed729b287ae5dbbcf073aaa70dce29a73c7431e446d5958271af19dac8d8 Libs/libmariadb.a
29-
8e587e9ed0b4291345f16a647bc7ed2dc30edbee87b9887eef94098d574aac13 Libs/libmongoc_arm64.a
30-
553b6636a37886dd44732dddcb97f6e8192dc1b3fbb914042c8da8a9685ce163 Libs/libmongoc_universal.a
31-
ce569e738c0f62f13906095bc33e10f20d62cd32535db89bc6af6231e86c1632 Libs/libmongoc_x86_64.a
32-
553b6636a37886dd44732dddcb97f6e8192dc1b3fbb914042c8da8a9685ce163 Libs/libmongoc.a
29+
9f4c87916ef65eae43b19d7568dc4fd4dffd884dc0cae15913b90965293339a7 Libs/libmongoc_arm64.a
30+
0d7ddc82dc7327a4b5187ffbc68a1419b5e5ff7b2be7b927e16793eef4d34303 Libs/libmongoc_universal.a
31+
635705c7dc8d689efdee5ec1bd8a8cbd0d09ae20db0869480271a293d492de50 Libs/libmongoc_x86_64.a
32+
0d7ddc82dc7327a4b5187ffbc68a1419b5e5ff7b2be7b927e16793eef4d34303 Libs/libmongoc.a
3333
5dbf2cb5ef37d8adbf607db82461b36a3fd7037c11d891383e6e918378a33d78 Libs/libpgcommon_arm64.a
3434
3ca491a723b9d9dfc13b815659b44a82253b540dd6b115f03ac68c5154ec26db Libs/libpgcommon_universal.a
3535
4bfad7376aefa866d1ed0b7e54966ec6c9d70dcfed928e1311c20321bf08881c Libs/libpgcommon_x86_64.a

Plugins/MongoDBDriverPlugin/CLibMongoc/include/mongoc/mongoc-config.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
* MONGOC_ENABLE_SSL_SECURE_TRANSPORT is set from configure to determine if we are
7979
* compiled with Native SSL support on Darwin
8080
*/
81-
#define MONGOC_ENABLE_SSL_SECURE_TRANSPORT 0
81+
#define MONGOC_ENABLE_SSL_SECURE_TRANSPORT 1
8282

8383
#if MONGOC_ENABLE_SSL_SECURE_TRANSPORT != 1
8484
# undef MONGOC_ENABLE_SSL_SECURE_TRANSPORT
@@ -89,7 +89,7 @@
8989
* MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO is set from configure to determine if we are
9090
* compiled with Native Crypto support on Darwin
9191
*/
92-
#define MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO 0
92+
#define MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO 1
9393

9494
#if MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO != 1
9595
# undef MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO
@@ -111,7 +111,7 @@
111111
* MONGOC_ENABLE_SSL_OPENSSL is set from configure to determine if we are
112112
* compiled with OpenSSL support.
113113
*/
114-
#define MONGOC_ENABLE_SSL_OPENSSL 1
114+
#define MONGOC_ENABLE_SSL_OPENSSL 0
115115

116116
#if MONGOC_ENABLE_SSL_OPENSSL != 1
117117
# undef MONGOC_ENABLE_SSL_OPENSSL
@@ -122,7 +122,7 @@
122122
* MONGOC_ENABLE_CRYPTO_LIBCRYPTO is set from configure to determine if we are
123123
* compiled with OpenSSL support.
124124
*/
125-
#define MONGOC_ENABLE_CRYPTO_LIBCRYPTO 1
125+
#define MONGOC_ENABLE_CRYPTO_LIBCRYPTO 0
126126

127127
#if MONGOC_ENABLE_CRYPTO_LIBCRYPTO != 1
128128
# undef MONGOC_ENABLE_CRYPTO_LIBCRYPTO
@@ -164,7 +164,7 @@
164164
/*
165165
* Use ASN1_STRING_get0_data () rather than the deprecated ASN1_STRING_data
166166
*/
167-
#define MONGOC_HAVE_ASN1_STRING_GET0_DATA 1
167+
#define MONGOC_HAVE_ASN1_STRING_GET0_DATA 0
168168

169169
#if MONGOC_HAVE_ASN1_STRING_GET0_DATA != 1
170170
# undef MONGOC_HAVE_ASN1_STRING_GET0_DATA
@@ -338,7 +338,7 @@
338338
* Set if we have zstd compression support
339339
*
340340
*/
341-
#define MONGOC_ENABLE_COMPRESSION_ZSTD 1
341+
#define MONGOC_ENABLE_COMPRESSION_ZSTD 0
342342

343343
#if MONGOC_ENABLE_COMPRESSION_ZSTD != 1
344344
# undef MONGOC_ENABLE_COMPRESSION_ZSTD

TablePro.xcodeproj/project.pbxproj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,8 +2477,10 @@
24772477
"$(PROJECT_DIR)/Libs/libmongoc.a",
24782478
"-force_load",
24792479
"$(PROJECT_DIR)/Libs/libbson.a",
2480-
"-lssl",
2481-
"-lcrypto",
2480+
"-framework",
2481+
Security,
2482+
"-framework",
2483+
CoreFoundation,
24822484
"-lresolv",
24832485
"-lz",
24842486
);
@@ -2517,8 +2519,10 @@
25172519
"$(PROJECT_DIR)/Libs/libmongoc.a",
25182520
"-force_load",
25192521
"$(PROJECT_DIR)/Libs/libbson.a",
2520-
"-lssl",
2521-
"-lcrypto",
2522+
"-framework",
2523+
Security,
2524+
"-framework",
2525+
CoreFoundation,
25222526
"-lresolv",
25232527
"-lz",
25242528
);

scripts/build-libmongoc.sh

Lines changed: 8 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ run_quiet() {
1919
# libbson_arm64.a, libbson_x86_64.a, libbson_universal.a
2020
# libmongoc_arm64.a, libmongoc_x86_64.a, libmongoc_universal.a
2121
#
22-
# OpenSSL is built from source to match the app's deployment target,
23-
# preventing "Symbol not found" crashes from Homebrew-built libraries.
22+
# Uses macOS SecureTransport (ENABLE_SSL=DARWIN) for TLS so that
23+
# certificate verification uses the system Keychain automatically.
24+
# Note: SecureTransport is deprecated by Apple but still functional on
25+
# macOS 14+. It supports TLS 1.2 (no 1.3). MongoDB Atlas accepts TLS 1.2.
26+
# libmongoc does not support Network.framework as a TLS backend.
2427
#
2528
# All libraries are built with MACOSX_DEPLOYMENT_TARGET=14.0 to match
2629
# the app's minimum deployment target.
@@ -35,8 +38,6 @@ run_quiet() {
3538

3639
DEPLOY_TARGET="14.0"
3740
MONGOC_VERSION="1.28.1"
38-
OPENSSL_VERSION="3.4.1"
39-
OPENSSL_SHA256="002a2d6b30b58bf4bea46c43bdd96365aaf8daa6c428782aa4feee06da197df3"
4041
MONGOC_SHA256="a93259840f461b28e198311e32144f5f8dc9fbd74348029f2793774d781bb7da"
4142

4243
ARCH="${1:-both}"
@@ -46,7 +47,7 @@ LIBS_DIR="$PROJECT_DIR/Libs"
4647
BUILD_DIR="$(mktemp -d)"
4748
NCPU=$(sysctl -n hw.ncpu)
4849

49-
echo "🔧 Building static libmongoc $MONGOC_VERSION + OpenSSL $OPENSSL_VERSION"
50+
echo "🔧 Building static libmongoc $MONGOC_VERSION (SecureTransport)"
5051
echo " Deployment target: macOS $DEPLOY_TARGET"
5152
echo " Architecture: $ARCH"
5253
echo " Build dir: $BUILD_DIR"
@@ -61,12 +62,6 @@ trap cleanup EXIT
6162
download_sources() {
6263
echo "📥 Downloading source tarballs..."
6364

64-
if [ ! -f "$BUILD_DIR/openssl-$OPENSSL_VERSION.tar.gz" ]; then
65-
curl -fSL "https://github.com/openssl/openssl/releases/download/openssl-$OPENSSL_VERSION/openssl-$OPENSSL_VERSION.tar.gz" \
66-
-o "$BUILD_DIR/openssl-$OPENSSL_VERSION.tar.gz"
67-
fi
68-
echo "$OPENSSL_SHA256 $BUILD_DIR/openssl-$OPENSSL_VERSION.tar.gz" | shasum -a 256 -c -
69-
7065
if [ ! -f "$BUILD_DIR/mongo-c-driver-$MONGOC_VERSION.tar.gz" ]; then
7166
curl -fSL "https://github.com/mongodb/mongo-c-driver/releases/download/$MONGOC_VERSION/mongo-c-driver-$MONGOC_VERSION.tar.gz" \
7267
-o "$BUILD_DIR/mongo-c-driver-$MONGOC_VERSION.tar.gz"
@@ -76,46 +71,8 @@ download_sources() {
7671
echo "✅ Sources downloaded"
7772
}
7873

79-
build_openssl() {
80-
local arch=$1
81-
local prefix="$BUILD_DIR/install-openssl-$arch"
82-
83-
echo ""
84-
echo "🔨 Building OpenSSL $OPENSSL_VERSION for $arch..."
85-
86-
# Extract fresh copy for this arch
87-
rm -rf "$BUILD_DIR/openssl-$OPENSSL_VERSION-$arch"
88-
mkdir -p "$BUILD_DIR/openssl-$OPENSSL_VERSION-$arch"
89-
tar xzf "$BUILD_DIR/openssl-$OPENSSL_VERSION.tar.gz" -C "$BUILD_DIR/openssl-$OPENSSL_VERSION-$arch" --strip-components=1
90-
91-
cd "$BUILD_DIR/openssl-$OPENSSL_VERSION-$arch"
92-
93-
local target
94-
if [ "$arch" = "arm64" ]; then
95-
target="darwin64-arm64-cc"
96-
else
97-
target="darwin64-x86_64-cc"
98-
fi
99-
100-
MACOSX_DEPLOYMENT_TARGET=$DEPLOY_TARGET \
101-
./Configure \
102-
"$target" \
103-
no-shared \
104-
no-tests \
105-
no-apps \
106-
no-docs \
107-
--prefix="$prefix" \
108-
-mmacosx-version-min=$DEPLOY_TARGET > /dev/null 2>&1
109-
110-
run_quiet make -j"$NCPU"
111-
run_quiet make install_sw
112-
113-
echo "✅ OpenSSL $arch: $(ls -lh "$prefix/lib/libssl.a" | awk '{print $5}') (libssl) $(ls -lh "$prefix/lib/libcrypto.a" | awk '{print $5}') (libcrypto)"
114-
}
115-
11674
build_mongoc() {
11775
local arch=$1
118-
local openssl_prefix="$BUILD_DIR/install-openssl-$arch"
11976
local prefix="$BUILD_DIR/install-mongoc-$arch"
12077

12178
echo ""
@@ -139,12 +96,6 @@ build_mongoc() {
13996
mkdir -p "$build_dir"
14097
cd "$build_dir"
14198

142-
# Resolve OpenSSL library path (may be lib/ or lib64/)
143-
local openssl_lib_dir="$openssl_prefix/lib"
144-
if [ -f "$openssl_prefix/lib64/libssl.a" ]; then
145-
openssl_lib_dir="$openssl_prefix/lib64"
146-
fi
147-
14899
run_quiet env MACOSX_DEPLOYMENT_TARGET=$DEPLOY_TARGET \
149100
cmake .. \
150101
-DCMAKE_INSTALL_PREFIX="$prefix" \
@@ -159,13 +110,9 @@ build_mongoc() {
159110
-DENABLE_SRV=ON \
160111
-DENABLE_ZLIB=SYSTEM \
161112
-DENABLE_ZSTD=OFF \
162-
-DENABLE_SSL=OPENSSL \
113+
-DENABLE_SSL=DARWIN \
163114
-DENABLE_TESTS=OFF \
164-
-DENABLE_EXAMPLES=OFF \
165-
-DOPENSSL_ROOT_DIR="$openssl_prefix" \
166-
-DOPENSSL_INCLUDE_DIR="$openssl_prefix/include" \
167-
-DOPENSSL_SSL_LIBRARY="$openssl_lib_dir/libssl.a" \
168-
-DOPENSSL_CRYPTO_LIBRARY="$openssl_lib_dir/libcrypto.a"
115+
-DENABLE_EXAMPLES=OFF
169116

170117
run_quiet cmake --build . --parallel "$NCPU"
171118
run_quiet cmake --install .
@@ -226,7 +173,6 @@ create_universal() {
226173

227174
build_for_arch() {
228175
local arch=$1
229-
build_openssl "$arch"
230176
build_mongoc "$arch"
231177
install_libs "$arch"
232178
# Install headers once (they're arch-independent)

0 commit comments

Comments
 (0)