Add validation for scheme
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
3bd0ce72a5
commit
3f71e11018
|
@ -58,6 +58,10 @@ func (api *LinkInfoApi) DefaultLinkHandler(link string) (*LinkInfo, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if u.Scheme != "http" && u.Scheme != "https" {
|
||||||
|
return nil, errors.New("unsupported scheme")
|
||||||
|
}
|
||||||
|
|
||||||
if u.Host == "localhost" {
|
if u.Host == "localhost" {
|
||||||
return nil, errors.New("url is localhost")
|
return nil, errors.New("url is localhost")
|
||||||
} else if ip := net.ParseIP(u.Host); ip != nil && isPrivateIP(ip) {
|
} else if ip := net.ParseIP(u.Host); ip != nil && isPrivateIP(ip) {
|
||||||
|
|
Loading…
Reference in New Issue