Skip to content

Honor SSL_CERT_FILE and REQUESTS_CA_BUNDLE for TLS verification - #1034

Open
SachuJames wants to merge 1 commit into
massive-com:masterfrom
SachuJames:ssl-ca-bundle-env-998
Open

SachuJames wants to merge 1 commit into
massive-com:masterfrom
SachuJames:ssl-ca-bundle-env-998

Conversation

@SachuJames

Copy link
Copy Markdown

Both the REST and websocket clients hardcode certifi.where() for TLS verification, so setting SSL_CERT_FILE or REQUESTS_CA_BUNDLE has no effect. Anyone behind a corporate proxy with a custom CA bundle cannot use the SDK.

Fixes #998

What changed:

  • New massive/certs.py with ca_bundle_path(): resolves SSL_CERT_FILE first, then REQUESTS_CA_BUNDLE, falling back to certifi.where().
  • massive/rest/base.py: PoolManager now uses ca_bundle_path() for ca_certs.
  • massive/websocket/__init__.py: extracted the inline SSL context into _ssl_context(), loading ca_bundle_path().

Tests:

  • New test_rest/test_ssl.py (7 tests): env precedence, certifi default, and client-level check via connection_pool_kw["ca_certs"].
  • New test_websocket/test_ssl.py (4 tests): mocked load_verify_locations captures the bundle path; ws:// builds no context.
  • The client-level tests fail on the pre-fix code and pass after. Full suites green: 46 rest + 5 websocket. black and mypy clean on the changed files.

Both clients hardcoded the certifi bundle, so custom CA bundles (common
behind corporate TLS inspection) were silently ignored. Resolve the CA
bundle from SSL_CERT_FILE, then REQUESTS_CA_BUNDLE, falling back to
certifi as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SDK does not respect SSL_CERT_FILE or REQUESTS_CA_BUNDLE environment variables

1 participant