From 38eed35ffb70bda2f9ee02b84eaa311d537ae5ae Mon Sep 17 00:00:00 2001 From: Mateusz Szewczyk <139469471+MateuszOssGit@users.noreply.github.com> Date: Tue, 17 Mar 2026 23:50:55 +0100 Subject: [PATCH] fix: Fixed CodeQL security scan about Incomplete URL substring sanitization on watsonx test suite (#12212) * fix: Fixed CodeQL security scan about Incomplete URL substring sanitization * fix coderabbitai comments * fix: nightly now properly gets 1.9.0 branch (#12215) before it was attempting to pull release-notes as letters are alphanumerically after numbers when we sort -V then grab tail now we only look at branch names that follow the pattern '^release-[0-9]+\.[0-9]+\.[0-9]+$' * fix failing action * docs: add search icon (#12216) add-back-svg * Revert "Merge branch 'main' into dev-fix-security-code-scan-watsonx" This reverts commit 41eb034e1136f08fb4e5fe3748c14ff06c0c8a56, reversing changes made to 4e51f4d836885552b93258e0e797750a22a36e14. * Revert "Merge branch 'main' into dev-fix-security-code-scan-watsonx" This reverts commit 4e51f4d836885552b93258e0e797750a22a36e14, reversing changes made to 530bddd0a4193095bd575467d428d9d208e9c680. --------- Co-authored-by: Adam-Aghili <149833988+Adam-Aghili@users.noreply.github.com> Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com> --- .../tests/unit/components/ibm/test_watsonx.py | 14 ++++++++++++-- .../components/ibm/test_watsonx_embeddings.py | 19 ++++++++++++------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/lfx/tests/unit/components/ibm/test_watsonx.py b/src/lfx/tests/unit/components/ibm/test_watsonx.py index 9678ca70ec..5a4b289a93 100644 --- a/src/lfx/tests/unit/components/ibm/test_watsonx.py +++ b/src/lfx/tests/unit/components/ibm/test_watsonx.py @@ -66,9 +66,19 @@ class TestWatsonxAIComponent: """Test that API URLs are defined.""" from lfx.components.ibm.watsonx import WatsonxAIComponent + expected_urls = [ + "https://us-south.ml.cloud.ibm.com", + "https://eu-de.ml.cloud.ibm.com", + "https://eu-gb.ml.cloud.ibm.com", + "https://au-syd.ml.cloud.ibm.com", + "https://jp-tok.ml.cloud.ibm.com", + "https://ca-tor.ml.cloud.ibm.com", + "https://ap-south-1.aws.wxai.ibm.com", + ] assert len(WatsonxAIComponent._urls) > 0 - assert "https://us-south.ml.cloud.ibm.com" in WatsonxAIComponent._urls - assert "https://eu-de.ml.cloud.ibm.com" in WatsonxAIComponent._urls + + for url in expected_urls: + assert url in WatsonxAIComponent._urls, f"Expected URL {url} not found in WatsonxAIComponent._urls" def test_inputs_defined(self, wx_component): """Test that all required inputs are defined.""" diff --git a/src/lfx/tests/unit/components/ibm/test_watsonx_embeddings.py b/src/lfx/tests/unit/components/ibm/test_watsonx_embeddings.py index 98a5d9e7ab..81be0f6c66 100644 --- a/src/lfx/tests/unit/components/ibm/test_watsonx_embeddings.py +++ b/src/lfx/tests/unit/components/ibm/test_watsonx_embeddings.py @@ -83,13 +83,18 @@ class TestWatsonxEmbeddingsComponent: """Test that URL options are defined.""" url_input = next(inp for inp in wx_embeddings_component.inputs if inp.name == "url") - assert "https://us-south.ml.cloud.ibm.com" in url_input.options - assert "https://eu-de.ml.cloud.ibm.com" in url_input.options - assert "https://eu-gb.ml.cloud.ibm.com" in url_input.options - assert "https://au-syd.ml.cloud.ibm.com" in url_input.options - assert "https://jp-tok.ml.cloud.ibm.com" in url_input.options - assert "https://ca-tor.ml.cloud.ibm.com" in url_input.options - assert "https://ap-south-1.aws.wxai.ibm.com" in url_input.options + expected_urls = [ + "https://us-south.ml.cloud.ibm.com", + "https://eu-de.ml.cloud.ibm.com", + "https://eu-gb.ml.cloud.ibm.com", + "https://au-syd.ml.cloud.ibm.com", + "https://jp-tok.ml.cloud.ibm.com", + "https://ca-tor.ml.cloud.ibm.com", + "https://ap-south-1.aws.wxai.ibm.com", + ] + + for url in expected_urls: + assert url in url_input.options, f"Expected URL {url} not found in options" @patch("lfx.base.models.model_utils.requests.get") def test_fetch_models_success(self, mock_get, mock_response):