github-advanced-security[bot] commented on code in PR #73534:
URL: https://github.com/apache/airflow/pull/73534#discussion_r4070650785


##########
providers/common/ai/tests/unit/common/ai/toolsets/test_sandbox.py:
##########
@@ -199,6 +199,39 @@
         # Plain HTTP is the trap worth naming, because nothing refuses it.
         assert "plain HTTP" in description
 
+    @pytest.mark.asyncio
+    async def 
test_an_address_allowlist_names_the_ranges_and_that_names_still_resolve(self):
+        # Measured: hostnames resolve under a CIDR list, but only listed 
addresses answer.
+        # Without saying so the model reads a successful lookup as a reachable 
host.
+        toolset = SandboxToolset(
+            _RecordingBackend(),
+            spec=SandboxSpec(block_network=True, 
allow_egress_to_cidrs=["10.20.0.0/16", "203.0.113.7/32"]),
+        )
+
+        description = (await 
toolset.get_tools(_ctx()))["run_command"].tool_def.description
+        assert "10.20.0.0/16, 203.0.113.7/32" in description
+        assert "on any port" in description
+        assert "hostnames still resolve" in description
+        assert "plain HTTP" not in description, "plain HTTP is only a trap 
under the hostname list"
+
+    @pytest.mark.asyncio
+    async def test_both_lists_are_described_together(self):
+        toolset = SandboxToolset(
+            _RecordingBackend(),
+            spec=SandboxSpec(
+                block_network=True, allow_egress_to=["pypi.org"], 
allow_egress_to_cidrs=["10.20.0.0/16"]
+            ),
+        )
+
+        description = (await 
toolset.get_tools(_ctx()))["run_command"].tool_def.description
+        assert "pypi.org" in description

Review Comment:
   ## CodeQL / Incomplete URL substring sanitization
   
   The string [pypi.org](1) may be at an arbitrary position in the sanitized 
URL.
   
   [Show more 
details](https://github.com/apache/airflow/security/code-scanning/658)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to