From 94c046951b36de51490e6eb7376ceec2c515a20a Mon Sep 17 00:00:00 2001 From: Anas Khan <83116240+anxkhn@users.noreply.github.com> Date: Sun, 5 Jul 2026 09:13:38 +0530 Subject: [PATCH 1/2] fix: render solid rule borders in disabled-SSL warning banner When SSL verification is disabled, create_ssl_context logs a warning banner meant to be framed by three 60-character rules of '='. Each rule was written as a string literal immediately followed by "=" * 60, e.g. "\n" "=" * 60. Python applies implicit string-literal concatenation before the "*" repetition, so this parsed as ("\n=") * 60 and produced a jagged column of single '=' signs on their own lines instead of one solid rule. Add an explicit "+" before each "=" * 60 so the repetition applies to "=" alone. All three borders now render as solid 60-character rules. Add a regression test asserting the disabled-verification warning contains exactly three solid 60-character rules and no stray single-'=' rows. Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com> --- .../kagent-adk/src/kagent/adk/models/_ssl.py | 9 +++---- .../tests/unittests/models/test_ssl.py | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/python/packages/kagent-adk/src/kagent/adk/models/_ssl.py b/python/packages/kagent-adk/src/kagent/adk/models/_ssl.py index a634a58e49..1944fbe9e4 100644 --- a/python/packages/kagent-adk/src/kagent/adk/models/_ssl.py +++ b/python/packages/kagent-adk/src/kagent/adk/models/_ssl.py @@ -188,14 +188,11 @@ def create_ssl_context( # Structured logging for TLS configuration at startup if disable_verify: logger.warning( - "\n" - "=" * 60 + "\n" - "⚠️ SSL VERIFICATION DISABLED ⚠️\n" - "=" * 60 + "\n" + "\n" + "=" * 60 + "\n" + "⚠️ SSL VERIFICATION DISABLED ⚠️\n" + "=" * 60 + "\n" "SSL certificate verification is disabled.\n" "This should ONLY be used in development/testing.\n" - "Production deployments MUST use proper certificates.\n" - "=" * 60 + "Production deployments MUST use proper certificates.\n" + "=" * 60 ) logger.info("TLS Mode: Disabled (disable_verify=True)") return False # httpx accepts False to disable verification diff --git a/python/packages/kagent-adk/tests/unittests/models/test_ssl.py b/python/packages/kagent-adk/tests/unittests/models/test_ssl.py index e66c92b840..1fd2d2c982 100644 --- a/python/packages/kagent-adk/tests/unittests/models/test_ssl.py +++ b/python/packages/kagent-adk/tests/unittests/models/test_ssl.py @@ -8,6 +8,7 @@ """ import logging +import re import ssl import tempfile from pathlib import Path @@ -123,3 +124,28 @@ def test_ssl_context_disabled_logs_warning(caplog): assert ssl_context is False assert "SSL VERIFICATION DISABLED" in caplog.text assert "development/testing" in caplog.text.lower() + + +def test_ssl_context_disabled_warning_banner_borders(caplog): + """The disabled-verification warning renders solid 60-char rule borders. + + Guards against string-concatenation vs. ``*`` precedence: writing + ``"\n" "=" * 60`` binds the implicit concatenation first, yielding + ``"\n=" * 60`` (a jagged column of single ``=`` signs) instead of a + newline followed by a 60-character rule. The banner has three such + rules (top, separator, bottom); each must be a solid 60-char run. + """ + with caplog.at_level(logging.WARNING): + create_ssl_context( + disable_verify=True, + ca_cert_path=None, + disable_system_cas=False, + ) + + rule = "=" * 60 + assert rule in caplog.text + # No stray single-'=' rows: every run of '=' is the full 60-char rule. + runs = re.findall(r"=+", caplog.text) + assert runs, "warning banner should contain '=' rule borders" + assert all(run == rule for run in runs) + assert len(runs) == 3 From c87c24bea32ebece44f74f4c15c7385fd9350e6a Mon Sep 17 00:00:00 2001 From: Anas Khan <83116240+anxkhn@users.noreply.github.com> Date: Tue, 14 Jul 2026 17:09:15 +0530 Subject: [PATCH 2/2] test: remove SSL warning border regression test Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com> --- .../tests/unittests/models/test_ssl.py | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/python/packages/kagent-adk/tests/unittests/models/test_ssl.py b/python/packages/kagent-adk/tests/unittests/models/test_ssl.py index 1fd2d2c982..e66c92b840 100644 --- a/python/packages/kagent-adk/tests/unittests/models/test_ssl.py +++ b/python/packages/kagent-adk/tests/unittests/models/test_ssl.py @@ -8,7 +8,6 @@ """ import logging -import re import ssl import tempfile from pathlib import Path @@ -124,28 +123,3 @@ def test_ssl_context_disabled_logs_warning(caplog): assert ssl_context is False assert "SSL VERIFICATION DISABLED" in caplog.text assert "development/testing" in caplog.text.lower() - - -def test_ssl_context_disabled_warning_banner_borders(caplog): - """The disabled-verification warning renders solid 60-char rule borders. - - Guards against string-concatenation vs. ``*`` precedence: writing - ``"\n" "=" * 60`` binds the implicit concatenation first, yielding - ``"\n=" * 60`` (a jagged column of single ``=`` signs) instead of a - newline followed by a 60-character rule. The banner has three such - rules (top, separator, bottom); each must be a solid 60-char run. - """ - with caplog.at_level(logging.WARNING): - create_ssl_context( - disable_verify=True, - ca_cert_path=None, - disable_system_cas=False, - ) - - rule = "=" * 60 - assert rule in caplog.text - # No stray single-'=' rows: every run of '=' is the full 60-char rule. - runs = re.findall(r"=+", caplog.text) - assert runs, "warning banner should contain '=' rule borders" - assert all(run == rule for run in runs) - assert len(runs) == 3