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