From a90041d71aa1ee3c0e4040c42ebc7ff488220802 Mon Sep 17 00:00:00 2001 From: Gusted Date: Wed, 2 Mar 2022 01:37:32 +0000 Subject: [PATCH] Send 404 on `/{org}.gpg` (#18959) --- routers/web/org/home.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/routers/web/org/home.go b/routers/web/org/home.go index d07e2993b2..fc81ceb719 100644 --- a/routers/web/org/home.go +++ b/routers/web/org/home.go @@ -6,6 +6,7 @@ package org import ( "net/http" + "strings" "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/db" @@ -23,7 +24,14 @@ const ( // Home show organization home page func Home(ctx *context.Context) { - ctx.SetParams(":org", ctx.Params(":username")) + uname := ctx.Params(":username") + + if strings.HasSuffix(uname, ".keys") || strings.HasSuffix(uname, ".gpg") { + ctx.NotFound("", nil) + return + } + + ctx.SetParams(":org", uname) context.HandleOrgAssignment(ctx) if ctx.Written() { return