소스 검색

Prevent redirect to Host (#9678) (#9679)

tags/v1.11.0-rc2
zeripath 4 년 전
부모
커밋
3a00a690c9
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2
    1
      modules/context/context.go

+ 2
- 1
modules/context/context.go 파일 보기

@@ -1,4 +1,5 @@
// Copyright 2014 The Gogs Authors. All rights reserved.
// Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

@@ -122,7 +123,7 @@ func (ctx *Context) RedirectToFirst(location ...string) {
}

u, err := url.Parse(loc)
if err != nil || (u.Scheme != "" && !strings.HasPrefix(strings.ToLower(loc), strings.ToLower(setting.AppURL))) {
if err != nil || ((u.Scheme != "" || u.Host != "") && !strings.HasPrefix(strings.ToLower(loc), strings.ToLower(setting.AppURL))) {
continue
}


Loading…
취소
저장