mirror of
https://github.com/minio/minio.git
synced 2025-11-08 21:24:55 -05:00
gateway: Reject endpoint pointing to local gateway (#4310)
Show an error when the user enters an endpoint url pointing to the gateway server itself.
This commit is contained in:
committed by
Harshavardhana
parent
59b3e0b79b
commit
542f7ae42c
@@ -127,14 +127,10 @@ func NewEndpoint(arg string) (Endpoint, error) {
|
||||
return Endpoint{}, fmt.Errorf("empty or root path is not supported in URL endpoint")
|
||||
}
|
||||
|
||||
// Get IPv4 address of the host.
|
||||
hostIPs, err := getHostIP4(host)
|
||||
isLocal, err = isLocalHost(host)
|
||||
if err != nil {
|
||||
return Endpoint{}, err
|
||||
}
|
||||
|
||||
// If intersection of two IP sets is not empty, then the host is local host.
|
||||
isLocal = !localIP4.Intersection(hostIPs).IsEmpty()
|
||||
} else {
|
||||
u = &url.URL{Path: path.Clean(arg)}
|
||||
isLocal = true
|
||||
|
||||
Reference in New Issue
Block a user