Skip to content

Commit

Permalink
sec: BI-0 update versions (#651)
Browse files Browse the repository at this point in the history
sec: update versions
  • Loading branch information
ovsds authored Oct 16, 2024
1 parent 9bba364 commit 56ea7f0
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 162 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import importlib.metadata
import logging
import os
from typing import Any
Expand Down Expand Up @@ -135,7 +136,12 @@ def home():

client = app.test_client()
for c_name, c_val in request_cookies.items():
client.set_cookie("localhost", c_name, c_val)
# TODO: after migration to werkzeug 3.0.3+, replace this condition with
# client.set_cookie(key=c_name, value=c_val)
if importlib.metadata.version("werkzeug") == "3.0.3":
client.set_cookie(key=c_name, value=c_val)
else:
client.set_cookie(server_name="localhost", key=c_name, value=c_val)

resp = client.get(
request_path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,18 @@ async def run(self) -> TaskResult:
conn: aiohttp.BaseConnector
if self._ctx.secure_reader_settings.endpoint is not None:
secure_reader_endpoint = self._ctx.secure_reader_settings.endpoint
# TODO: after migration to aiohttp 3.9.4+ replace with
# ssl_context: ssl.SSLContext | True = True
ssl_context: Optional[ssl.SSLContext] = None
if self._ctx.secure_reader_settings.cafile is not None:
ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS)
ssl_context.load_verify_locations(cafile=self._ctx.secure_reader_settings.cafile)
conn = aiohttp.TCPConnector(ssl=ssl_context)
# TODO: after migration to aiohttp 3.9.4+ replace condition with
# aiohttp.TCPConnector(ssl=ssl_context)
if ssl_context is not None:
conn = aiohttp.TCPConnector(ssl=ssl_context)
else:
conn = aiohttp.TCPConnector()
else:
socket_path = self._ctx.secure_reader_settings.socket
secure_reader_endpoint = f"http+unix://{urllib.parse.quote_plus(socket_path)}"
Expand Down
Loading

0 comments on commit 56ea7f0

Please sign in to comment.