a2a.utils.push_url_validator module

Shared policy for screening client-supplied push-notification URLs.

async a2a.utils.push_url_validator.validate_push_notification_url(url: str) → bool

Return True if a push-notification URL is safe to fetch.

Blocks non-HTTP(S) schemes and hosts that resolve to loopback, link-local, private, shared (100.64.0.0/10), reserved, multicast, or unspecified addresses (e.g. 169.254.169.254 cloud metadata, internal services). A host that cannot be resolved is rejected: the POST would fail anyway, and failing closed avoids treating resolution errors as a bypass.

IPv4-mapped IPv6 forms are judged as the IPv4 address they carry, so the private, shared, and loopback checks apply to that address.

Uses the running event-loop resolver so request handlers and the sender stay non-blocking. Deployments can pass this function as push_url_validator on DefaultRequestHandler / DefaultRequestHandlerV2 / BasePushNotificationSender. The default on those constructors is None (no library screening).