Ensure other repositories are given as ssh URL
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
1ab2df8228
commit
79814fba21
@ -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.Contains(uri.Host, "epita.fr") {
|
||||||
if !strings.HasPrefix(uri.Path, fmt.Sprintf("/%s/", u.Login)) {
|
if !strings.HasPrefix(uri.Path, fmt.Sprintf("/%s/", u.Login)) {
|
||||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": "repository URL forbidden"})
|
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{"errmsg": "repository URL forbidden"})
|
||||||
|
Reference in New Issue
Block a user