mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-05 12:33:23 +09:00
fix(httplib): prevent leaking localhost:3000 in public links (#39217)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
co-authored by
wxiaoguang
parent
52fcd2d2a0
commit
bcd913a4e2
@@ -130,13 +130,18 @@ func ArtifactsRoutes(prefix string) *web.Router {
|
||||
return m
|
||||
}
|
||||
|
||||
func newArtifactContext(resp http.ResponseWriter, req *http.Request) *ArtifactContext {
|
||||
base := context.NewBaseContext(resp, req)
|
||||
ctx := &ArtifactContext{Base: base}
|
||||
ctx.SetContextValue(artifactContextKey, ctx)
|
||||
httplib.MarkRequestSupportPublicURL(ctx)
|
||||
return ctx
|
||||
}
|
||||
|
||||
func ArtifactContexter() func(next http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
|
||||
base := context.NewBaseContext(resp, req)
|
||||
|
||||
ctx := &ArtifactContext{Base: base}
|
||||
ctx.SetContextValue(artifactContextKey, ctx)
|
||||
ctx := newArtifactContext(resp, req)
|
||||
|
||||
// action task call server api with Bearer ACTIONS_RUNTIME_TOKEN
|
||||
// we should verify the ACTIONS_RUNTIME_TOKEN
|
||||
|
||||
Reference in New Issue
Block a user