File tree 6 files changed +31
-7
lines changed 6 files changed +31
-7
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ steps:
109
109
depends_on : [test-frontend]
110
110
111
111
- name : build-backend-no-gcc
112
- image : golang:1.17 # this step is kept as the lowest version of golang that we support
112
+ image : golang:1.16 # this step is kept as the lowest version of golang that we support
113
113
pull : always
114
114
environment :
115
115
GO111MODULE : on
Original file line number Diff line number Diff line change @@ -203,10 +203,13 @@ help:
203
203
go-check :
204
204
$(eval MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2) )
205
205
$(eval MIN_GO_VERSION := $(shell printf "% 03d% 03d% 03d" $(shell echo '$(MIN_GO_VERSION_STR ) ' | tr '.' ' ') ) )
206
- $(eval GO_VERSION := $(shell printf "% 03d% 03d% 03d" $(shell $(GO ) version | grep -Eo '[0-9]+\.[0-9.]+' | tr '.' ' ') ;) )
206
+ $(eval GO_VERSION_STR := $(shell $(GO ) version | grep -Eo '[0-9]+\.[0-9.]+') )
207
+ $(eval GO_VERSION := $(shell printf "% 03d% 03d% 03d" $(shell echo '$(GO_VERSION_STR ) ' | tr '.' ' ') ) )
207
208
@if [ " $( GO_VERSION) " -lt " $( MIN_GO_VERSION) " ]; then \
208
- echo " Gitea requires Go $( MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/" ; \
209
+ echo " Gitea requires Go $( MIN_GO_VERSION_STR) or greater to build, but $( GO_VERSION ) was found . You can get an updated version at https://go.dev/dl/" ; \
209
210
exit 1; \
211
+ else \
212
+ echo " WARNING: Please ensure Go $( GO_VERSION_STR) is still maintained to avoid possible security problems. You can check it at https://go.dev/dl/" ; \
210
213
fi
211
214
212
215
.PHONY : git-check
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ params:
19
19
author : The Gitea Authors
20
20
website : https://docs.gitea.io
21
21
version : 1.16.4
22
- minGoVersion : 1.17
22
+ minGoVersion : 1.16
23
23
goVersion : 1.18
24
24
minNodeVersion : 12.17
25
25
Original file line number Diff line number Diff line change 1
1
module code.gitea.io/gitea
2
2
3
- go 1.17
3
+ go 1.16
4
4
5
5
require (
6
6
cloud.google.com/go v0.99.0 // indirect
Original file line number Diff line number Diff line change 8
8
"net"
9
9
"path/filepath"
10
10
"strings"
11
+
12
+ "code.gitea.io/gitea/modules/util"
11
13
)
12
14
13
15
// HostMatchList is used to check if a host or IP is in a list.
@@ -102,11 +104,11 @@ func (hl *HostMatchList) checkIP(ip net.IP) bool {
102
104
for _ , builtin := range hl .builtins {
103
105
switch builtin {
104
106
case MatchBuiltinExternal :
105
- if ip .IsGlobalUnicast () && ! ip . IsPrivate ( ) {
107
+ if ip .IsGlobalUnicast () && ! util . IsIPPrivate ( ip ) {
106
108
return true
107
109
}
108
110
case MatchBuiltinPrivate :
109
- if ip . IsPrivate ( ) {
111
+ if util . IsIPPrivate ( ip ) {
110
112
return true
111
113
}
112
114
case MatchBuiltinLoopback :
Original file line number Diff line number Diff line change
1
+ // Copyright 2021 The Gitea Authors. All rights reserved.
2
+ // Use of this source code is governed by a MIT-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ package util
6
+
7
+ import (
8
+ "net"
9
+ )
10
+
11
+ // IsIPPrivate for net.IP.IsPrivate.
12
+ func IsIPPrivate (ip net.IP ) bool {
13
+ if ip4 := ip .To4 (); ip4 != nil {
14
+ return ip4 [0 ] == 10 ||
15
+ (ip4 [0 ] == 172 && ip4 [1 ]& 0xf0 == 16 ) ||
16
+ (ip4 [0 ] == 192 && ip4 [1 ] == 168 )
17
+ }
18
+ return len (ip ) == net .IPv6len && ip [0 ]& 0xfe == 0xfc
19
+ }
You can’t perform that action at this time.
0 commit comments