Home / Function/ is_cloud_metadata() — langchain Function Reference

is_cloud_metadata() — langchain Function Reference

Architecture documentation for the is_cloud_metadata() function in _ssrf_protection.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  b037f749_0dbd_866d_b123_d0a75dc719aa["is_cloud_metadata()"]
  76eef743_34da_b2b6_eda1_09a024269dbd["_ssrf_protection.py"]
  b037f749_0dbd_866d_b123_d0a75dc719aa -->|defined in| 76eef743_34da_b2b6_eda1_09a024269dbd
  6c828a82_ad0c_f5f1_d776_92c196a03eaf["validate_safe_url()"]
  6c828a82_ad0c_f5f1_d776_92c196a03eaf -->|calls| b037f749_0dbd_866d_b123_d0a75dc719aa
  style b037f749_0dbd_866d_b123_d0a75dc719aa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/_security/_ssrf_protection.py lines 87–105

def is_cloud_metadata(hostname: str, ip_str: str | None = None) -> bool:
    """Check if hostname or IP is a cloud metadata endpoint.

    Args:
        hostname: Hostname to check
        ip_str: Optional IP address to check

    Returns:
        True if hostname or IP is a known cloud metadata endpoint
    """
    # Check hostname
    if hostname.lower() in CLOUD_METADATA_HOSTNAMES:
        return True

    # Check IP
    if ip_str and ip_str in CLOUD_METADATA_IPS:  # noqa: SIM103
        return True

    return False

Domain

Subdomains

Frequently Asked Questions

What does is_cloud_metadata() do?
is_cloud_metadata() is a function in the langchain codebase, defined in libs/core/langchain_core/_security/_ssrf_protection.py.
Where is is_cloud_metadata() defined?
is_cloud_metadata() is defined in libs/core/langchain_core/_security/_ssrf_protection.py at line 87.
What calls is_cloud_metadata()?
is_cloud_metadata() is called by 1 function(s): validate_safe_url.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free