From 4b22a8acb1113bea41633651e2eb32724f4215eb Mon Sep 17 00:00:00 2001 From: Rasmus Paltschik <91126255+EficodeRjpalt@users.noreply.github.com> Date: Thu, 19 Jun 2025 11:18:31 +0300 Subject: [PATCH] Potential fix for code scanning alert no. 1: Incomplete URL substring sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- tests/test_config_util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_config_util.py b/tests/test_config_util.py index b2f5749..7486b15 100644 --- a/tests/test_config_util.py +++ b/tests/test_config_util.py @@ -97,7 +97,10 @@ def test_custom_url_logged(self, caplog): # Check that the URL is mentioned in log messages log_messages = [record.message for record in caplog.records] - assert any("https://test.api.com" in msg for msg in log_messages) + from urllib.parse import urlparse + parsed_url = urlparse("https://test.api.com") + expected_hostname = parsed_url.hostname + assert any(expected_hostname in urlparse(msg).hostname for msg in log_messages if urlparse(msg).hostname) def test_default_url_logged(self, caplog): """Test that default API URL is logged in debug messages."""