From 0f7780d29ef54c664fc585061a093288857934c0 Mon Sep 17 00:00:00 2001 From: krastanov <2611182+vkrastanov@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:59:23 +0300 Subject: [PATCH] respect CLI's SSLDisabled setting in import_from_cf_cli MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- cloudfoundry_client/main/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cloudfoundry_client/main/main.py b/cloudfoundry_client/main/main.py index 6d5b4b7..f201b81 100644 --- a/cloudfoundry_client/main/main.py +++ b/cloudfoundry_client/main/main.py @@ -71,7 +71,7 @@ def import_from_clf_cli(): with open(get_config_file(), "w") as f: f.write( json.dumps( - dict(target_endpoint=cf_cli_data["Target"], verify=False, refresh_token=cf_cli_data["RefreshToken"]), indent=2 + dict(target_endpoint=cf_cli_data["Target"], verify=not bool(cf_cli_data.get("SSLDisabled", False)), refresh_token=cf_cli_data["RefreshToken"]), indent=2 ) )