test: ipv4 in v6 address checking (#1271)
* test: ipv4 in v6 address checking * fix(lib/policy): unmap 4in6 addresses in RemoteAddrChecker Signed-off-by: Xe Iaso <me@xeiaso.net> * docs: update CHANGELOG Signed-off-by: Xe Iaso <me@xeiaso.net> * docs: perfect CHANGELOG Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <me@xeiaso.net> Co-authored-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
1e298f5d0e
commit
a5bb6d2751
3 changed files with 22 additions and 2 deletions
|
|
@ -51,6 +51,11 @@ func (rac *RemoteAddrChecker) Check(r *http.Request) (bool, error) {
|
|||
return false, fmt.Errorf("%w: %s is not an IP address: %w", ErrMisconfiguration, host, err)
|
||||
}
|
||||
|
||||
// Convert IPv4-mapped IPv6 addresses to IPv4
|
||||
if addr.Is6() && addr.Is4In6() {
|
||||
addr = addr.Unmap()
|
||||
}
|
||||
|
||||
return rac.prefixTable.Contains(addr), nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue