Skip to content

respect CLI's SSLDisabled setting in import_from_cf_cli - #332

Open
vkrastanov wants to merge 1 commit into
cloudfoundry-community:mainfrom
vkrastanov:patch-1
Open

vkrastanov wants to merge 1 commit into
cloudfoundry-community:mainfrom
vkrastanov:patch-1

Conversation

@vkrastanov

@vkrastanov vkrastanov commented Oct 22, 2026 •

Copy link
Copy Markdown

Fix import_from_cf_cli to persist the source CLI's TLS setting instead of hardcoding verify=False What
import_from_cf_cli() (main/main.py) writes verify=False unconditionally into ~/.cf_client_python.json, ignoring the source CF CLI's SSLDisabled setting. Why

  • Incorrect behavior: a CF CLI with TLS validation enabled (SSLDisabled: false) ends up with a python client that has validation disabled — the import silently inverts the user's actual configuration.
  • Inconsistent with the rest of the codebase: the interactive first-run path (build_client_from_configuration) already persists the user's real choice (verify=(verify == "true")); only the import path hardcodes a constant. The default for CloudFoundryClient itself is verify=True.
  • Silent and persistent: the value is written once and re-read verbatim by every subsequent command, with no prompt or warning, so the mismatch outlives the original session where it would be noticed.

verify=not bool(cf_cli_data.get("SSLDisabled", False))

  • SSLDisabled: false (normal) → verify: true
  • SSLDisabled: true (cf login --skip-ssl-validation) → verify: false, honoring the user's choice
  • key absent → true (fail-safe default)

Fix import_from_cf_cli to persist the source CLI's TLS setting instead of hardcoding verify=False
What
import_from_cf_cli() (main/main.py) writes verify=False unconditionally into ~/.cf_client_python.json, ignoring the source CF CLI's SSLDisabled setting.
Why
- Incorrect behavior: a CF CLI with TLS validation enabled (SSLDisabled: false) ends up with a python client that has validation disabled — the import silently inverts the user's actual configuration.
- Inconsistent with the rest of the codebase: the interactive first-run path (build_client_from_configuration) already persists the user's real choice (verify=(verify == "true")); only the import path hardcodes a constant. The default for CloudFoundryClient itself is verify=True.
- Silent and persistent: the value is written once and re-read verbatim by every subsequent command, with no prompt or warning, so the mismatch outlives the original session where it would be noticed.
Change
One line at the write site:
verify=not bool(cf_cli_data.get("SSLDisabled", False))
- SSLDisabled: false (normal) → verify: true
- SSLDisabled: true (cf login --skip-ssl-validation) → verify: false, honoring the user's choice
- key absent → true (fail-safe default)
@vkrastanov

Copy link
Copy Markdown
Author

Hi @antechrestos, can you please review the change?

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