TestSSRFProtectedUrlType Class — langchain Architecture
Architecture documentation for the TestSSRFProtectedUrlType class in test_ssrf_protection.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 90d82f29_5d97_f49e_e7da_b35b58154c98["TestSSRFProtectedUrlType"] 0a8d2a49_20ba_b7b4_8bfd_e6c768864657["test_ssrf_protection.py"] 90d82f29_5d97_f49e_e7da_b35b58154c98 -->|defined in| 0a8d2a49_20ba_b7b4_8bfd_e6c768864657 0770cceb_eae4_3f35_38cd_4f6684295269["test_valid_url_accepted()"] 90d82f29_5d97_f49e_e7da_b35b58154c98 -->|method| 0770cceb_eae4_3f35_38cd_4f6684295269 7f609825_3e66_9a8e_a57a_3b7b2d375c69["test_localhost_rejected()"] 90d82f29_5d97_f49e_e7da_b35b58154c98 -->|method| 7f609825_3e66_9a8e_a57a_3b7b2d375c69 c6be69b9_b7dc_1fc5_f575_bec2eb871928["test_private_ip_rejected()"] 90d82f29_5d97_f49e_e7da_b35b58154c98 -->|method| c6be69b9_b7dc_1fc5_f575_bec2eb871928 d0af8ffe_9f46_6caf_f689_6fd32cd12ab6["test_cloud_metadata_rejected()"] 90d82f29_5d97_f49e_e7da_b35b58154c98 -->|method| d0af8ffe_9f46_6caf_f689_6fd32cd12ab6
Relationship Graph
Source Code
libs/core/tests/unit_tests/test_ssrf_protection.py lines 212–249
class TestSSRFProtectedUrlType:
"""Tests for SSRFProtectedUrl Pydantic type."""
def test_valid_url_accepted(self) -> None:
"""Test that valid URLs are accepted by Pydantic schema."""
class WebhookSchema(BaseModel):
url: SSRFProtectedUrl
schema = WebhookSchema(url="https://hooks.slack.com/services/xxx")
assert str(schema.url).startswith("https://hooks.slack.com/")
def test_localhost_rejected(self) -> None:
"""Test that localhost URLs are rejected by Pydantic schema."""
class WebhookSchema(BaseModel):
url: SSRFProtectedUrl
with pytest.raises(ValidationError):
WebhookSchema(url="http://localhost:8080")
def test_private_ip_rejected(self) -> None:
"""Test that private IPs are rejected by Pydantic schema."""
class WebhookSchema(BaseModel):
url: SSRFProtectedUrl
with pytest.raises(ValidationError):
WebhookSchema(url="http://192.168.1.1")
def test_cloud_metadata_rejected(self) -> None:
"""Test that cloud metadata is rejected by Pydantic schema."""
class WebhookSchema(BaseModel):
url: SSRFProtectedUrl
with pytest.raises(ValidationError):
WebhookSchema(url="http://169.254.169.254/latest/meta-data/")
Source
Frequently Asked Questions
What is the TestSSRFProtectedUrlType class?
TestSSRFProtectedUrlType is a class in the langchain codebase, defined in libs/core/tests/unit_tests/test_ssrf_protection.py.
Where is TestSSRFProtectedUrlType defined?
TestSSRFProtectedUrlType is defined in libs/core/tests/unit_tests/test_ssrf_protection.py at line 212.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free