Skip to content

Commit 0073d60

Browse files
lunnytechknowlogick
authored and
Sysoev, Vladimir
committed
Add proxy host into allow list (go-gitea#20798)
Co-authored-by: techknowlogick <[email protected]>
1 parent 9f26437 commit 0073d60

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

modules/hostmatcher/hostmatcher.go

+5
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ func (hl *HostMatchList) AppendBuiltin(builtin string) {
7878
hl.builtins = append(hl.builtins, builtin)
7979
}
8080

81+
// AppendPattern appends more pattern to match
82+
func (hl *HostMatchList) AppendPattern(pattern string) {
83+
hl.patterns = append(hl.patterns, pattern)
84+
}
85+
8186
// IsEmpty checks if the checklist is empty
8287
func (hl *HostMatchList) IsEmpty() bool {
8388
return hl == nil || (len(hl.builtins) == 0 && len(hl.patterns) == 0 && len(hl.ipNets) == 0)

services/migrations/migrate.go

+5
Original file line numberDiff line numberDiff line change
@@ -479,5 +479,10 @@ func Init() error {
479479
}
480480
// TODO: at the moment, if ALLOW_LOCALNETWORKS=false, ALLOWED_DOMAINS=domain.com, and domain.com has IP 127.0.0.1, then it's still allowed.
481481
// if we want to block such case, the private&loopback should be added to the blockList when ALLOW_LOCALNETWORKS=false
482+
483+
if setting.Proxy.Enabled && setting.Proxy.ProxyURLFixed != nil {
484+
allowList.AppendPattern(setting.Proxy.ProxyURLFixed.Host)
485+
}
486+
482487
return nil
483488
}

0 commit comments

Comments
 (0)