Documentation Index
Fetch the complete documentation index at: https://docs.prefect.io/llms.txt
Use this file to discover all available pages before exploring further.
prefect.utilities.urls
Functions
validate_restricted_url
getaddrinfo. Because DNS can change between this check and the
actual HTTP connection, callers that need hardened SSRF protection should
also use SSRFProtectedAsyncHTTPTransport / SSRFProtectedHTTPTransport,
which re-validate at connection time and connect to the pre-resolved IP to
close the TOCTOU window exploited by DNS rebinding attacks.
Args:
url: The URL to validate.
ValueError: If the URL is a restricted URL.
convert_class_to_name
url_for
obj: A Prefect object to get the URL for, or its URL name and ID.obj_id: The UUID of the object.url_type: Whether to return the URL for the UI (default) or API.default_base_url: The default base URL to use if no URL is configured.additional_format_kwargs: Additional keyword arguments to pass to the URL format.
- Optional[str]: The URL for the given object or None if the object is not supported.
Classes
SSRFProtectedAsyncHTTPTransport
An httpx.AsyncHTTPTransport that guards against DNS rebinding SSRF.
Behaves identically to httpx.AsyncHTTPTransport except that, for every
request, the hostname is resolved, every resolved address is checked
against the private-address blocklist, and the connection is made to the
specific validated IP. This closes the TOCTOU window between a pre-flight
validate_restricted_url check and the actual HTTP connection.
SSRFProtectedHTTPTransport
Synchronous counterpart of SSRFProtectedAsyncHTTPTransport.