File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import (
2929 "code.gitea.io/gitea/modules/log"
3030 "code.gitea.io/gitea/modules/process"
3131 "code.gitea.io/gitea/modules/setting"
32+ "code.gitea.io/gitea/modules/structs"
3233 "code.gitea.io/gitea/modules/timeutil"
3334 repo_service "code.gitea.io/gitea/services/repository"
3435)
@@ -135,6 +136,16 @@ func HTTP(ctx *context.Context) {
135136 environ []string
136137 )
137138
139+ // don't allow anonymous pulls if organization is not public
140+ if isPublicPull {
141+ if err := repo .GetOwner (); err != nil {
142+ ctx .ServerError ("GetOwner" , err )
143+ return
144+ }
145+
146+ askAuth = askAuth || (repo .Owner .Visibility != structs .VisibleTypePublic )
147+ }
148+
138149 // check access
139150 if askAuth {
140151 authUsername = ctx .Req .Header .Get (setting .ReverseProxyAuthUser )
You can’t perform that action at this time.
0 commit comments