auth: AuthorizedHttp.configure_mtls_channel() drops custom PoolManager settings

Đang mở
#18,366 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
authentication

Hướng nghiên cứu

Bắt đầu trong packages/google-auth/google/auth/transport/urllib3.py bằng cách đọc _make_mutual_tls_http() và AuthorizedHttp.configure_mtls_channel(), sau đó so sánh hành vi duy trì trong requests transport. Cập nhật phạm vi kiểm thử unit liên quan trong packages/google-auth/tests/transport/test_urllib3.py để các thiết lập tùy chỉnh về retry, kích thước pool, timeout và header vẫn được giữ lại sau khi cấu hình mTLS, rồi chạy các kiểm thử đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

auth priority: p2 type: bug

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.

Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
2 ngày 22 giờ
Pull request đã merge (30 ngày)
102

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của googleapis/google-cloud-python

Tất cả issue của googleapis/google-cloud-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.