From 483f53aaa6368783ca4d1dd95a02544027a2cf08 Mon Sep 17 00:00:00 2001 From: Mohd Kaif <98801504+KaifAhmad1@users.noreply.github.com> Date: Sat, 22 Aug 2026 15:12:52 +0530 Subject: [PATCH] fix(tests): use exact-equality check to clear CodeQL substring-URL false positive (#1183) CodeQL (py/incomplete-url-substring-sanitization) flagged the "https://schema.org/" in flattened check because it pattern-matches on URL-ish strings tested with `in`. flattened is always a list here, so the check was already exact membership, not a substring test on untrusted input, but the ambiguous idiom tripped the scanner. Rewrite as an explicit equality comparison so the intent is unambiguous. --- tests/export/test_jsonld_default_graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/export/test_jsonld_default_graph.py b/tests/export/test_jsonld_default_graph.py index c66b9a1a..e9f8dc09 100644 --- a/tests/export/test_jsonld_default_graph.py +++ b/tests/export/test_jsonld_default_graph.py @@ -160,7 +160,7 @@ def test_a_url_valued_context_is_not_thrown_away(tmp_path): context = json.loads(path.read_text())["@context"] flattened = context if isinstance(context, list) else [context] - assert "https://schema.org/" in flattened, ( + assert any(entry == "https://schema.org/" for entry in flattened), ( "the caller's context was replaced by Semantica's defaults, " "which silently changes how every term expands" )