aboutsummaryrefslogtreecommitdiff
path: root/internal/form
diff options
context:
space:
mode:
authorJoe Chen <jc@unknwon.io>2022-03-14 22:06:08 +0800
committerGitHub <noreply@github.com>2022-03-14 22:06:08 +0800
commit714383a063f64fcc7c6a458182c4f9cf5a46df66 (patch)
treeebed76f917e9817cd78c4dda07813f93f3bb16bd /internal/form
parenta2c632526111b3333de482c69709a7ca70a173f8 (diff)
conf: add allowlist for accessing local network (#6842)
Diffstat (limited to 'internal/form')
-rw-r--r--internal/form/repo.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/form/repo.go b/internal/form/repo.go
index bc0dc426..adcbc66a 100644
--- a/internal/form/repo.go
+++ b/internal/form/repo.go
@@ -12,6 +12,7 @@ import (
"github.com/unknwon/com"
"gopkg.in/macaron.v1"
+ "gogs.io/gogs/internal/conf"
"gogs.io/gogs/internal/db"
"gogs.io/gogs/internal/netutil"
)
@@ -71,7 +72,7 @@ func (f MigrateRepo) ParseRemoteAddr(user *db.User) (string, error) {
return "", db.ErrInvalidCloneAddr{IsURLError: true}
}
- if netutil.IsLocalHostname(u.Hostname()) {
+ if netutil.IsLocalHostname(u.Hostname(), conf.Security.LocalNetworkAllowlist) {
return "", db.ErrInvalidCloneAddr{IsURLError: true}
}