mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-15 03:27:24 +08:00
Address review feedback (1 comments)
This commit is contained in:
parent
5585cca20b
commit
0934c87a45
@ -84,7 +84,12 @@ class InternalRoutes:
|
|||||||
if remote is None:
|
if remote is None:
|
||||||
raise web.HTTPForbidden(reason="Internal endpoints are only accessible from localhost")
|
raise web.HTTPForbidden(reason="Internal endpoints are only accessible from localhost")
|
||||||
try:
|
try:
|
||||||
if not ipaddress.ip_address(remote).is_loopback:
|
addr = ipaddress.ip_address(remote)
|
||||||
|
# Unwrap IPv4-mapped IPv6 addresses (e.g. ::ffff:127.0.0.1) so that
|
||||||
|
# is_loopback correctly evaluates the underlying IPv4 address.
|
||||||
|
if isinstance(addr, ipaddress.IPv6Address) and addr.ipv4_mapped is not None:
|
||||||
|
addr = addr.ipv4_mapped
|
||||||
|
if not addr.is_loopback:
|
||||||
raise web.HTTPForbidden(reason="Internal endpoints are only accessible from localhost")
|
raise web.HTTPForbidden(reason="Internal endpoints are only accessible from localhost")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise web.HTTPForbidden(reason="Internal endpoints are only accessible from localhost")
|
raise web.HTTPForbidden(reason="Internal endpoints are only accessible from localhost")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user