Skip to content

fix: expose ca_cert_file_path and insecure_skip_verify in init_from_api_key - #1438

Open
cosmicBboy wants to merge 1 commit into
mainfrom
fix/init-from-api-key-tls-options
Open

fix: expose ca_cert_file_path and insecure_skip_verify in init_from_api_key#1438
cosmicBboy wants to merge 1 commit into
mainfrom
fix/init-from-api-key-tls-options

Conversation

@cosmicBboy

Copy link
Copy Markdown
Collaborator

Problem

Users behind corporate TLS-intercepting proxies (MITM proxies that re-sign traffic with a private corporate CA) get:

httpcore.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate

when authenticating via flyte.init_from_api_key() and then making any remote call (the failure surfaces on the OAuth token refresh POST). flyte.init() already supports insecure_skip_verify and ca_cert_file_path, but init_from_api_key hardcoded insecure_skip_verify=False and exposed neither parameter — so API-key users had no way to supply a corporate CA bundle.

Fix

Add insecure_skip_verify: bool = False and ca_cert_file_path: str | None = None to init_from_api_key and forward them to the underlying init.aio(...) call (insecure remains hardcoded to False). Defaults are unchanged, so existing behavior is preserved.

import flyte

flyte.init_from_api_key(ca_cert_file_path="/etc/ssl/certs/ca-certificates.crt")

The docstring notes that if both options are set, insecure_skip_verify takes precedence (matching the behavior of _resolve_tls_ca_cert and get_async_authenticator, which check insecure_skip_verify first).

Tests

  • tests/flyte/test_init_from_api_key.py: new tests asserting the TLS defaults (insecure_skip_verify=False, ca_cert_file_path=None) and that explicitly passed values are forwarded to init.aio, with insecure still False.
  • tests/user_api/test_init_api_key.py: async (.aio) equivalents of the same assertions.
  • Full run of tests/flyte/test_init_from_api_key.py, tests/user_api/test_init_api_key.py, and tests/cli/test_api_key_with_config.py: 20 passed. ruff check/ruff format, mypy, and ty all pass.

🤖 Generated with Claude Code

…pi_key

Users behind TLS-intercepting corporate proxies hit
`SSL: CERTIFICATE_VERIFY_FAILED` on the OAuth token refresh when
authenticating with `flyte.init_from_api_key()`, because the function
hardcoded `insecure_skip_verify=False` and offered no way to supply a
custom CA bundle. `flyte.init()` already supports both options, so
thread them through from `init_from_api_key` as well.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant