Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use proper tls client config in neuro-sdk #2931

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion neuro-sdk/src/neuro_sdk/_config_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,19 @@ def _make_session(
async def __make_session(
timeout: aiohttp.ClientTimeout, trace_configs: Optional[List[aiohttp.TraceConfig]]
) -> aiohttp.ClientSession:
import warnings

from . import __version__

ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS)
with warnings.catch_warnings():
# TODO (A.K., 2023-03-15): Use PROTOCOL_TLS_CLIENT
# Starting from 3.10, ssl.PROTOCOL_TLS
# is deprecated in favor of PROTOCOL_TLS_CLIENT/SERVER
# Simply changing to CLIENT caused more errors with CAs,
# this (temporary) fix will allow some failing tests in platform services
# (that depend on neuro-sdk) to pass, e.g. platform-monitoring
warnings.filterwarnings("ignore", category=DeprecationWarning)
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS)
ssl_context.load_verify_locations(capath=certifi.where())
connector = aiohttp.TCPConnector(ssl=ssl_context)
return aiohttp.ClientSession(
Expand Down