all repos — elgit @ 44e7c584adf41a335897f8a9a9722138a6f19670

fork of legit: web frontend for git, written in go

don't use user input for repository path access

Alan Pearce
commit

44e7c584adf41a335897f8a9a9722138a6f19670

parent

9c621945f4985e3fce4e12fc25e1d7898b117aa3

1 file changed, 2 insertions(+), 2 deletions(-)

changed files
M routes/routes.goroutes/routes.go
@@ -152,8 +152,8 @@ }
func (d *deps) Archive(rc *atreugo.RequestCtx) error { repoName, _ := rc.UserValue("repoName").(string) - repoPath, _ := rc.UserValue("repoPath").(string) + repo := d.repos.BySlug[repoName] file := rc.UserValue("file").(string) if !strings.HasSuffix(file, ".tar.gz") {
@@ -167,7 +167,7 @@ filename := fmt.Sprintf("%s-%s.tar.gz", repoName, ref)
setContentDisposition(rc, filename) setGZipMIME(rc) - gr, err := git.Open(repoPath, ref) + gr, err := git.Open(repo.Path, ref) if err != nil { return d.NotFound(rc) }