googleapis / googleapis/google-cloud-python

auth: AuthorizedHttp.configure_mtls_channel() drops custom PoolManager settings

オープン
#18,366 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
auth priority: p2 type: bug
主要言語
Python
スター
5.4k
フォーク
1.8k
平均マージ
3日 4時間
マージ済み PR(30日)
122

説明

In `packages/google-auth/google/auth/transport/urllib3.py`, calling `AuthorizedHttp.configure_mtls_channel()` replaces `self.http` by calling `_make_mutual_tls_http(cert, key)`, which constructs a new `urllib3.PoolManager(ssl_context=ctx)` without copying non-SSL pool settings from the existing `self.http` instance.

When callers initialize `AuthorizedHttp(credentials, http=custom_pool_manager)` with custom retry policies (`retries`), connection pool sizing (`maxsize`, `num_pools`), timeouts (`timeout`), or default headers (`headers`), calling `configure_mtls_channel()` discards all of those custom configurations and emits a `UserWarning` stating that the `http` object provided in the constructor is overwritten.

By contrast, `AuthorizedSession.configure_mtls_channel()` in `packages/google-auth/google/auth/transport/requests.py` preserves custom retry and connection pool sizing (`max_retries`, `pool_connections`, `pool_maxsize`, `pool_block`) from the existing `HTTPAdapter` when mounting `_MutualTlsAdapter`.

### Proposed Fix

Update `_make_mutual_tls_http()` in `packages/google-auth/google/auth/transport/urllib3.py` to accept optional `PoolManager` keyword arguments, and update `AuthorizedHttp.configure_mtls_channel()` to extract non-SSL configuration settings (`retries`, `maxsize`, `block`, `timeout`, `headers`, and `num_pools`) from `self.http` and forward them when constructing the mTLS `PoolManager`.

Update unit tests in `packages/google-auth/tests/transport/test_urllib3.py` to verify that custom retry, pool sizing, timeout, and header configurations on a user-provided `PoolManager` are preserved across `configure_mtls_channel()` calls.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start in packages/google-auth/google/auth/transport/urllib3.py by reading _make_mutual_tls_http() and AuthorizedHttp.configure_mtls_channel(), then compare the preservation behavior in the requests transport. Update the related unit coverage in packages/google-auth/tests/transport/test_urllib3.py so custom retry, pool sizing, timeout, and header settings remain after mTLS configuration, and run those tests.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
authentication
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
76/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。