Skip to content

Commit fcd7856

Browse files
committed
Remove ReverseProxy authentication from the API
Since we changed the /api/v1/ routes to disallow session authentication we also removed their reliance on CSRF. However, we left the ReverseProxy authentication here - but this means that POSTs to the API are no longer protected by CSRF. Now, ReverseProxy authentication is a kind of session authentication, and is therefore inconsistent with the removal of session from the API. This PR proposes that we simply remove the ReverseProxy authentication from the API and therefore users of the API must explicitly use tokens or basic authentication. Replace go-gitea#22077 Signed-off-by: Andrew Thornton <art27@cantab.net>
1 parent 7bf7c13 commit fcd7856

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

routers/api/v1/api.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,6 @@ func reqExploreSignIn() func(ctx *context.APIContext) {
232232

233233
func reqBasicOrRevProxyAuth() func(ctx *context.APIContext) {
234234
return func(ctx *context.APIContext) {
235-
if ctx.IsSigned && setting.Service.EnableReverseProxyAuth && ctx.Data["AuthedMethod"].(string) == auth.ReverseProxyMethodName {
236-
return
237-
}
238235
if !ctx.Context.IsBasicAuth {
239236
ctx.Error(http.StatusUnauthorized, "reqBasicOrRevProxyAuth", "auth required")
240237
return
@@ -598,9 +595,6 @@ func buildAuthGroup() *auth.Group {
598595
&auth.HTTPSign{},
599596
&auth.Basic{}, // FIXME: this should be removed once we don't allow basic auth in API
600597
)
601-
if setting.Service.EnableReverseProxyAuth {
602-
group.Add(&auth.ReverseProxy{})
603-
}
604598
specialAdd(group)
605599

606600
return group

0 commit comments

Comments
 (0)