Skip to content

Commit

Permalink
Merge pull request #38 from bitleak/feature/add-namespace-validator
Browse files Browse the repository at this point in the history
MOD: add namespace param validator in NewToken
  • Loading branch information
git-hulk committed Jun 18, 2020
2 parents b89acc7 + 3eeefc0 commit 385f301
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/handlers/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ func NewToken(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"error": "the namespace name was too long"})
return
}
if !paramRegex.MatchString(namespace) {
c.JSON(http.StatusBadRequest, gin.H{"error": "namespace name contains forbidden characters"})
return
}
pool := c.Query("pool")
var rawToken string
if userToken == "" {
Expand Down

0 comments on commit 385f301

Please sign in to comment.