aboutsummaryrefslogtreecommitdiff
path: root/internal/form
diff options
context:
space:
mode:
Diffstat (limited to 'internal/form')
-rw-r--r--internal/form/repo.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/form/repo.go b/internal/form/repo.go
index ed963307..bc0dc426 100644
--- a/internal/form/repo.go
+++ b/internal/form/repo.go
@@ -13,6 +13,7 @@ import (
"gopkg.in/macaron.v1"
"gogs.io/gogs/internal/db"
+ "gogs.io/gogs/internal/netutil"
)
// _______________________________________ _________.______________________ _______________.___.
@@ -69,6 +70,11 @@ func (f MigrateRepo) ParseRemoteAddr(user *db.User) (string, error) {
if err != nil {
return "", db.ErrInvalidCloneAddr{IsURLError: true}
}
+
+ if netutil.IsLocalHostname(u.Hostname()) {
+ return "", db.ErrInvalidCloneAddr{IsURLError: true}
+ }
+
if len(f.AuthUsername)+len(f.AuthPassword) > 0 {
u.User = url.UserPassword(f.AuthUsername, f.AuthPassword)
}