Skip to content

fix: preserve explicit false SSL options#2639

Open
fengjikui wants to merge 1 commit into
googleapis:mainfrom
fengjikui:codex/preserve-false-ssl-options
Open

fix: preserve explicit false SSL options#2639
fengjikui wants to merge 1 commit into
googleapis:mainfrom
fengjikui:codex/preserve-false-ssl-options

Conversation

@fengjikui

Copy link
Copy Markdown

Fixes #2557.

Summary

  • preserve explicit falsy SSL options instead of treating them as missing
  • keep client_args={"verify": False} / async_client_args={"verify": False} as False for httpx
  • keep async_client_args={"ssl": False} as False for aiohttp and websocket paths
  • add regression coverage for the explicit False cases

Root cause

The SSL helpers used truthiness checks such as if not ctx and if not args.get(...). That makes an explicit False indistinguishable from an unset option, so the SDK replaced the user's disabled-verification setting with a default ssl.SSLContext.

Validation

  • env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy .venv/bin/python -m pytest google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_implicit_initialization google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_explicit_initialization_same_args google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_explicit_initialization_separate_args google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_explicit_initialization_sync_args google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_explicit_initialization_async_args google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_preserves_explicit_false_httpx_verify google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_preserves_explicit_false_aiohttp_ssl google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_preserves_explicit_false_websocket_ssl -q (10 passed)
  • env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy .venv/bin/python -m pytest google/genai/tests/client/test_client_initialization.py -q (90 passed)
  • git diff --check

@google-cla

google-cla Bot commented Jun 22, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Venkaiahbabuneelam Venkaiahbabuneelam self-assigned this Jun 23, 2026
@Venkaiahbabuneelam Venkaiahbabuneelam added the size:L Code changes between 40-100 lines label Jun 23, 2026
@fengjikui fengjikui force-pushed the codex/preserve-false-ssl-options branch from 06b26cf to 11476b4 Compare June 23, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L Code changes between 40-100 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] google-genai Python SDK overrides 'verify=False' in HttpOptions due to truthiness evaluation quirk

2 participants