Disallow listing artifact directory

This commit is contained in:
nemunaire 2021-05-02 22:23:22 +02:00
parent e3a911cd05
commit c60b4ddf73

6
app.go
View File

@ -34,7 +34,11 @@ func NewApp() App {
artifacts := http.Dir("./artifacts") artifacts := http.Dir("./artifacts")
router.GET("/artifacts/*path", func(c *gin.Context) { router.GET("/artifacts/*path", func(c *gin.Context) {
c.FileFromFS(c.Param("path"), artifacts) if c.Param("path") == "/" {
c.JSON(http.StatusForbidden, gin.H{"error": "Forbidden"})
} else {
c.FileFromFS(c.Param("path"), artifacts)
}
}) })
router.GET("/api/version", func(c *gin.Context) { router.GET("/api/version", func(c *gin.Context) {