Skip to content

Commit b77dab6

Browse files
authored
Merge branch 'master' into add-default-merge-style
2 parents b598ee4 + 598dd21 commit b77dab6

File tree

217 files changed

+26905
-19898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+26905
-19898
lines changed

.drone.yml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ steps:
2727

2828
- name: lint-backend
2929
pull: always
30-
image: golang:1.16
30+
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
3131
commands:
3232
- make lint-backend
3333
environment:
@@ -37,7 +37,7 @@ steps:
3737

3838
- name: lint-backend-windows
3939
pull: always
40-
image: golang:1.16
40+
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
4141
commands:
4242
- make golangci-lint vet
4343
environment:
@@ -49,7 +49,7 @@ steps:
4949

5050
- name: lint-backend-gogit
5151
pull: always
52-
image: golang:1.16
52+
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
5353
commands:
5454
- make lint-backend
5555
environment:
@@ -168,7 +168,7 @@ services:
168168
image: elasticsearch:7.5.0
169169

170170
- name: minio
171-
image: minio/minio:RELEASE.2021-01-16T02-19-44Z
171+
image: minio/minio:RELEASE.2021-03-12T00-00-47Z
172172
commands:
173173
- minio server /data
174174
environment:
@@ -223,10 +223,8 @@ steps:
223223
from_secret: github_read_token
224224

225225
- name: test-mysql
226-
image: golang:1.16
226+
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
227227
commands:
228-
- "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
229-
- apt-get install -y git-lfs
230228
- make test-mysql-migration integration-test-coverage
231229
environment:
232230
GOPROXY: off
@@ -238,10 +236,8 @@ steps:
238236
- build
239237

240238
- name: test-mysql8
241-
image: golang:1.16
239+
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
242240
commands:
243-
- "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
244-
- apt-get install -y git-lfs
245241
- timeout -s ABRT 40m make test-mysql8-migration test-mysql8
246242
environment:
247243
GOPROXY: off
@@ -252,10 +248,8 @@ steps:
252248
- build
253249

254250
- name: test-mssql
255-
image: golang:1.16
251+
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
256252
commands:
257-
- "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
258-
- apt-get install -y git-lfs
259253
- make test-mssql-migration test-mssql
260254
environment:
261255
GOPROXY: off
@@ -349,10 +343,8 @@ steps:
349343
TAGS: bindata gogit sqlite sqlite_unlock_notify
350344

351345
- name: test-sqlite
352-
image: golang:1.16
346+
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
353347
commands:
354-
- "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
355-
- apt-get install -y git-lfs
356348
- timeout -s ABRT 40m make test-sqlite-migration test-sqlite
357349
environment:
358350
GOPROXY: off
@@ -363,10 +355,8 @@ steps:
363355
- build
364356

365357
- name: test-pgsql
366-
image: golang:1.16
358+
image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
367359
commands:
368-
- "curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash"
369-
- apt-get install -y git-lfs
370360
- timeout -s ABRT 40m make test-pgsql-migration test-pgsql
371361
environment:
372362
GOPROXY: off

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ linters-settings:
2626
gocritic:
2727
disabled-checks:
2828
- ifElseChain
29-
- singleCaseSwitch # Every time this occured in the code, there was no other way.
29+
- singleCaseSwitch # Every time this occurred in the code, there was no other way.
3030

3131
issues:
3232
exclude-rules:

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7+
## [1.13.4](https://github.com/go-gitea/gitea/releases/tag/v1.13.4) - 2021-03-07
8+
9+
* SECURITY
10+
* Fix issue popups (#14898) (#14899)
11+
* BUGFIXES
12+
* Fix race in LFS ContentStore.Put(...) (#14895) (#14913)
13+
* Fix a couple of issues with a feeds (#14897) (#14903)
14+
* When transfering repository and database transaction failed, rollback the renames (#14864) (#14902)
15+
* Fix race in local storage (#14888) (#14901)
16+
* Fix 500 on pull view page if user is not loged in (#14885) (#14886)
17+
* DOCS
18+
* Fix how lfs data path is set (#14855) (#14884)
19+
720
## [1.13.3](https://github.com/go-gitea/gitea/releases/tag/v1.13.3) - 2021-03-04
821

922
* BREAKING

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ David Svantesson <[email protected]> (@davidsvantesson)
3939
a1012112796 <[email protected]> (@a1012112796)
4040
Karl Heinz Marbaise <[email protected]> (@khmarbaise)
4141
Norwin Roosen <[email protected]> (@noerw)
42+
Kyle Dumont <[email protected]> (@kdumontnu)
43+
Patrick Schratz <[email protected]> (@pat-s)

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ GO_SOURCES_OWN := $(filter-out vendor/% %/bindata.go, $(GO_SOURCES))
127127
#To update swagger use: GO111MODULE=on go get -u github.com/go-swagger/go-swagger/cmd/swagger
128128
SWAGGER := $(GO) run -mod=vendor github.com/go-swagger/go-swagger/cmd/swagger
129129
SWAGGER_SPEC := templates/swagger/v1_json.tmpl
130-
SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl}}/api/v1"|g
131-
SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl}}/api/v1"|"basePath": "/api/v1"|g
130+
SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl \| JSEscape \| Safe}}/api/v1"|g
131+
SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl \| JSEscape \| Safe}}/api/v1"|"basePath": "/api/v1"|g
132132
SWAGGER_EXCLUDE := code.gitea.io/sdk
133133
SWAGGER_NEWLINE_COMMAND := -e '$$a\'
134134

@@ -596,7 +596,7 @@ release-darwin: | $(DIST_DIRS)
596596
@hash xgo > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
597597
$(GO) install src.techknowlogick.com/xgo@latest; \
598598
fi
599-
CGO_CFLAGS="$(CGO_CFLAGS)" xgo -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin-10.12/amd64' -out gitea-$(VERSION) .
599+
CGO_CFLAGS="$(CGO_CFLAGS)" xgo -go $(XGO_VERSION) -dest $(DIST)/binaries -tags 'netgo osusergo $(TAGS)' -ldflags '$(LDFLAGS)' -targets 'darwin-10.12/amd64,darwin-10.12/arm64' -out gitea-$(VERSION) .
600600
ifeq ($(CI),drone)
601601
cp /build/* $(DIST)/binaries
602602
endif

cmd/web.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func runHTTPRedirector() {
6464
http.Redirect(w, r, target, http.StatusTemporaryRedirect)
6565
})
6666

67-
var err = runHTTP("tcp", source, context2.ClearHandler(handler))
67+
var err = runHTTP("tcp", source, "HTTP Redirector", context2.ClearHandler(handler))
6868

6969
if err != nil {
7070
log.Fatal("Failed to start port redirection: %v", err)
@@ -198,7 +198,7 @@ func listen(m http.Handler, handleRedirector bool) error {
198198
if handleRedirector {
199199
NoHTTPRedirector()
200200
}
201-
err = runHTTP("tcp", listenAddr, context2.ClearHandler(m))
201+
err = runHTTP("tcp", listenAddr, "Web", context2.ClearHandler(m))
202202
case setting.HTTPS:
203203
if setting.EnableLetsEncrypt {
204204
err = runLetsEncrypt(listenAddr, setting.Domain, setting.LetsEncryptDirectory, setting.LetsEncryptEmail, context2.ClearHandler(m))
@@ -211,22 +211,22 @@ func listen(m http.Handler, handleRedirector bool) error {
211211
NoHTTPRedirector()
212212
}
213213
}
214-
err = runHTTPS("tcp", listenAddr, setting.CertFile, setting.KeyFile, context2.ClearHandler(m))
214+
err = runHTTPS("tcp", listenAddr, "Web", setting.CertFile, setting.KeyFile, context2.ClearHandler(m))
215215
case setting.FCGI:
216216
if handleRedirector {
217217
NoHTTPRedirector()
218218
}
219-
err = runFCGI("tcp", listenAddr, context2.ClearHandler(m))
219+
err = runFCGI("tcp", listenAddr, "FCGI Web", context2.ClearHandler(m))
220220
case setting.UnixSocket:
221221
if handleRedirector {
222222
NoHTTPRedirector()
223223
}
224-
err = runHTTP("unix", listenAddr, context2.ClearHandler(m))
224+
err = runHTTP("unix", listenAddr, "Web", context2.ClearHandler(m))
225225
case setting.FCGIUnix:
226226
if handleRedirector {
227227
NoHTTPRedirector()
228228
}
229-
err = runFCGI("unix", listenAddr, context2.ClearHandler(m))
229+
err = runFCGI("unix", listenAddr, "Web", context2.ClearHandler(m))
230230
default:
231231
log.Fatal("Invalid protocol: %s", setting.Protocol)
232232
}

cmd/web_graceful.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ import (
1414
"code.gitea.io/gitea/modules/log"
1515
)
1616

17-
func runHTTP(network, listenAddr string, m http.Handler) error {
18-
return graceful.HTTPListenAndServe(network, listenAddr, m)
17+
func runHTTP(network, listenAddr, name string, m http.Handler) error {
18+
return graceful.HTTPListenAndServe(network, listenAddr, name, m)
1919
}
2020

21-
func runHTTPS(network, listenAddr, certFile, keyFile string, m http.Handler) error {
22-
return graceful.HTTPListenAndServeTLS(network, listenAddr, certFile, keyFile, m)
21+
func runHTTPS(network, listenAddr, name, certFile, keyFile string, m http.Handler) error {
22+
return graceful.HTTPListenAndServeTLS(network, listenAddr, name, certFile, keyFile, m)
2323
}
2424

25-
func runHTTPSWithTLSConfig(network, listenAddr string, tlsConfig *tls.Config, m http.Handler) error {
26-
return graceful.HTTPListenAndServeTLSConfig(network, listenAddr, tlsConfig, m)
25+
func runHTTPSWithTLSConfig(network, listenAddr, name string, tlsConfig *tls.Config, m http.Handler) error {
26+
return graceful.HTTPListenAndServeTLSConfig(network, listenAddr, name, tlsConfig, m)
2727
}
2828

2929
// NoHTTPRedirector tells our cleanup routine that we will not be using a fallback http redirector
@@ -43,9 +43,9 @@ func NoInstallListener() {
4343
graceful.GetManager().InformCleanup()
4444
}
4545

46-
func runFCGI(network, listenAddr string, m http.Handler) error {
46+
func runFCGI(network, listenAddr, name string, m http.Handler) error {
4747
// This needs to handle stdin as fcgi point
48-
fcgiServer := graceful.NewServer(network, listenAddr)
48+
fcgiServer := graceful.NewServer(network, listenAddr, name)
4949

5050
err := fcgiServer.ListenAndServe(func(listener net.Listener) error {
5151
return fcgi.Serve(listener, m)

cmd/web_letsencrypt.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
4646
go func() {
4747
log.Info("Running Let's Encrypt handler on %s", setting.HTTPAddr+":"+setting.PortToRedirect)
4848
// all traffic coming into HTTP will be redirect to HTTPS automatically (LE HTTP-01 validation happens here)
49-
var err = runHTTP("tcp", setting.HTTPAddr+":"+setting.PortToRedirect, myACME.HTTPChallengeHandler(http.HandlerFunc(runLetsEncryptFallbackHandler)))
49+
var err = runHTTP("tcp", setting.HTTPAddr+":"+setting.PortToRedirect, "Let's Encrypt HTTP Challenge", myACME.HTTPChallengeHandler(http.HandlerFunc(runLetsEncryptFallbackHandler)))
5050
if err != nil {
5151
log.Fatal("Failed to start the Let's Encrypt handler on port %s: %v", setting.PortToRedirect, err)
5252
}
5353
}()
5454
}
5555

56-
return runHTTPSWithTLSConfig("tcp", listenAddr, tlsConfig, context2.ClearHandler(m))
56+
return runHTTPSWithTLSConfig("tcp", listenAddr, "Web", tlsConfig, context2.ClearHandler(m))
5757
}
5858

5959
func runLetsEncryptFallbackHandler(w http.ResponseWriter, r *http.Request) {

custom/conf/app.example.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,10 @@ SSH_SERVER_KEY_EXCHANGES = diffie-hellman-group1-sha1, diffie-hellman-group14-sh
319319
; For the built-in SSH server, choose the MACs to support for SSH connections,
320320
; for system SSH this setting has no effect
321321
SSH_SERVER_MACS = [email protected], hmac-sha2-256, hmac-sha1, hmac-sha1-96
322+
; For the built-in SSH server, choose the keypair to offer as the host key
323+
; The private key should be at SSH_SERVER_HOST_KEY and the public SSH_SERVER_HOST_KEY.pub
324+
; relative paths are made absolute relative to the APP_DATA_PATH
325+
SSH_SERVER_HOST_KEYS=ssh/gitea.rsa, ssh/gogs.rsa
322326
; Directory to create temporary files in when testing public keys using ssh-keygen,
323327
; default is the system temporary directory.
324328
SSH_KEY_TEST_PATH =
@@ -545,6 +549,10 @@ COOKIE_REMEMBER_NAME = gitea_incredible
545549
; Reverse proxy authentication header name of user name
546550
REVERSE_PROXY_AUTHENTICATION_USER = X-WEBAUTH-USER
547551
REVERSE_PROXY_AUTHENTICATION_EMAIL = X-WEBAUTH-EMAIL
552+
; Interpret X-Forwarded-For header or the X-Real-IP header and set this as the remote IP for the request
553+
REVERSE_PROXY_LIMIT = 1
554+
; List of IP addresses and networks seperated by comma of trusted proxy servers. Use `*` to trust all.
555+
REVERSE_PROXY_TRUSTED_PROXIES = 127.0.0.0/8,::1/128
548556
; The minimum password length for new Users
549557
MIN_PASSWORD_LENGTH = 6
550558
; Set to true to allow users to import local server paths

docker/root/etc/templates/app.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ ROOT_PATH = /data/gitea/log
5353
[security]
5454
INSTALL_LOCK = $INSTALL_LOCK
5555
SECRET_KEY = $SECRET_KEY
56+
REVERSE_PROXY_LIMIT = 1
57+
REVERSE_PROXY_TRUSTED_PROXIES = *
5658

5759
[service]
5860
DISABLE_REGISTRATION = $DISABLE_REGISTRATION

0 commit comments

Comments
 (0)