googleapis / googleapis/google-cloud-python

auth: configure_mtls_channel() discards existing session configuration

Open
#18,314 0 comments 0 reactions 1 assignee Claimed by @agrawalradhika-cell View on GitHub
priority: p2 type: bug
Dominant language
Python
Stars
5.4k
Forks
1.8k
Avg merge
3d 4h
Merged PRs (30d)
122

Description

In `AsyncAuthorizedSession.configure_mtls_channel()` (`packages/google-auth/google/auth/aio/transport/sessions.py`), configuring mutual TLS replaces `self._auth_request` with a newly constructed `aiohttp.ClientSession` and `aiohttp.TCPConnector`:

```python
connector = aiohttp.TCPConnector(ssl=ssl_context)
new_session = aiohttp.ClientSession(connector=connector)
old_auth_request = self._auth_request
self._auth_request = AiohttpRequest(session=new_session)
```

Because `new_session` is instantiated from scratch with default arguments, we lose any custom configurations provided by callers on the initial session, such as connection pool limits, timeouts, etc.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.