a2a-source-edit: write tests/test_full_stack_contract.py
This commit is contained in:
@@ -136,6 +136,9 @@ async def test_url_policy_rejects_dangerous_inputs(monkeypatch):
|
|||||||
assert (await launch_agent._validate_public_url("file:///etc/passwd"))["code"] == "invalid_scheme"
|
assert (await launch_agent._validate_public_url("file:///etc/passwd"))["code"] == "invalid_scheme"
|
||||||
assert (await launch_agent._validate_public_url("https://user:pass@example.com"))["code"] == "credentials_not_allowed"
|
assert (await launch_agent._validate_public_url("https://user:pass@example.com"))["code"] == "credentials_not_allowed"
|
||||||
assert (await launch_agent._validate_public_url("http://169.254.169.254/latest/meta-data"))["code"] == "disallowed_private_target"
|
assert (await launch_agent._validate_public_url("http://169.254.169.254/latest/meta-data"))["code"] == "disallowed_private_target"
|
||||||
|
assert (await launch_agent._validate_public_url("https://example.com:8443"))["code"] == "disallowed_port"
|
||||||
|
assert launch_agent._ip_disallowed(__import__("ipaddress").ip_address("100.64.0.1")) is True
|
||||||
|
assert launch_agent._ip_disallowed(__import__("ipaddress").ip_address("192.0.2.10")) is True
|
||||||
|
|
||||||
async def fake_getaddrinfo(host, port, type):
|
async def fake_getaddrinfo(host, port, type):
|
||||||
return [(None, None, None, None, ("10.0.0.5", port))]
|
return [(None, None, None, None, ("10.0.0.5", port))]
|
||||||
|
|||||||
Reference in New Issue
Block a user