Skip to content

Commit e0a4565

Browse files
feat(networking): support system truststore for ssl trust chain [no:ci] (#92)
1 parent df3dfa4 commit e0a4565

4 files changed

Lines changed: 27 additions & 7 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ dependencies = [
9999
"platformdirs>=4.3.8",
100100
"boto3>=1.40.11",
101101
"certifi>=2025.8.3",
102-
"dicom-validator>=0.7.1",
102+
"dicom-validator>=0.7.2",
103103
"dicomweb-client[gcp]>=0.59.2",
104104
"duckdb>=0.10.0,<=1.4.0",
105105
"fastparquet>=2024.11.0",
@@ -126,6 +126,7 @@ dependencies = [
126126
"tqdm>=4.67.1",
127127
"urllib3>=2.5.0",
128128
"wsidicom>=0.27.1",
129+
"truststore>=0.10.4",
129130
]
130131

131132
[project.optional-dependencies]

src/aignostics/system/_service.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import platform
66
import re
7+
import ssl
78
import sys
89
import typing as t
910
from http import HTTPStatus
@@ -333,6 +334,9 @@ def info(include_environ: bool = False, mask_secrets: bool = True) -> dict[str,
333334
"public_ipv4": Service._get_public_ipv4(),
334335
"proxies": getproxies(),
335336
"requests_ca_bundle": os.getenv("REQUESTS_CA_BUNDLE"),
337+
"ssl_cert_file": os.getenv("SSL_CERT_FILE"),
338+
"ssl_cert_dir": os.getenv("SSL_CERT_DIR"),
339+
"ssl_default_verify_paths": ssl.get_default_verify_paths()._asdict(),
336340
},
337341
"uptime": {
338342
"seconds": uptime(),

src/aignostics/utils/boot.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
from pathlib import Path
77

88
import certifi
9+
import truststore
910

1011
from ._log import logging_initialize
1112

1213
_boot_called = False
1314

14-
if ssl.get_default_verify_paths().cafile is None and os.environ.get("SSL_CERT_FILE") is None:
15-
os.environ["SSL_CERT_FILE"] = certifi.where()
1615

1716
# Import third party dependencies
1817
third_party_dir = Path(__file__).parent.absolute() / ".." / "third_party"
@@ -33,6 +32,11 @@ def boot(modules_to_instrument: list[str]) -> None:
3332
return
3433
_boot_called = True
3534

35+
truststore.inject_into_ssl()
36+
37+
if ssl.get_default_verify_paths().cafile is None and os.environ.get("SSL_CERT_FILE") is None:
38+
os.environ["SSL_CERT_FILE"] = certifi.where()
39+
3640
from ._sentry import sentry_initialize # noqa: PLC0415
3741

3842
sentry_initialize()

uv.lock

Lines changed: 15 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)