mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-04 13:47:37 +02:00
Fix IPv6 addresses with IPv4 trusted proxies (#19134)
When an IPv6 address that doesn't map to an IPv4 address was checked against an IPv4 trusted proxy, we'd hit an exception because ip.ipv4_mapped was None. Fix this by verifying ipv4_mapped is not None Co-authored-by: me <me@me>
This commit is contained in:
parent
d574d1edae
commit
4b72c86e77
@ -71,7 +71,7 @@ def get_remote_addr(request: Request):
|
|||||||
)
|
)
|
||||||
if trusted_proxy.version == 4:
|
if trusted_proxy.version == 4:
|
||||||
ipv4 = ip.ipv4_mapped if ip.version == 6 else ip
|
ipv4 = ip.ipv4_mapped if ip.version == 6 else ip
|
||||||
if ipv4 in trusted_proxy:
|
if ipv4 is not None and ipv4 in trusted_proxy:
|
||||||
trusted = True
|
trusted = True
|
||||||
logger.debug(f"Trusted: {str(ip)} by {str(trusted_proxy)}")
|
logger.debug(f"Trusted: {str(ip)} by {str(trusted_proxy)}")
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user