diff --git a/repositories.go b/repositories.go index f6eb53f..cff6ca3 100644 --- a/repositories.go +++ b/repositories.go @@ -115,6 +115,11 @@ func declareAPIAuthRepositoriesRoutes(router *gin.RouterGroup) { } } + if uri.Scheme != "ssh" && uri.Scheme != "git+ssh" { + c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": "Unrecognized URL scheme. You need to provide a SSH repository URL."}) + return + } + if strings.Contains(uri.Host, "epita.fr") { if !strings.HasPrefix(uri.Path, fmt.Sprintf("/%s/", u.Login)) { c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": "repository URL forbidden"})