Home / Function/ is_private_ip() — langchain Function Reference

is_private_ip() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/langchain_core/_security/_ssrf_protection.py lines 71–84

def is_private_ip(ip_str: str) -> bool:
    """Check if an IP address is in a private range.

    Args:
        ip_str: IP address as a string (e.g., "192.168.1.1")

    Returns:
        True if IP is in a private range, False otherwise
    """
    try:
        ip = ipaddress.ip_address(ip_str)
        return any(ip in range_ for range_ in PRIVATE_IP_RANGES)
    except ValueError:
        return False

Domain

Subdomains

Frequently Asked Questions

What does is_private_ip() do?
is_private_ip() is a function in the langchain codebase, defined in libs/core/langchain_core/_security/_ssrf_protection.py.
Where is is_private_ip() defined?
is_private_ip() is defined in libs/core/langchain_core/_security/_ssrf_protection.py at line 71.
What calls is_private_ip()?
is_private_ip() 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