From 043664ff80186b00f818c3542b42c797987b804f Mon Sep 17 00:00:00 2001 From: Emile Date: Wed, 9 Oct 2019 12:27:21 +0200 Subject: filtering out bad usernames such as traefik and register --- src/http.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/http.go b/src/http.go index 9632787..7bddad6 100644 --- a/src/http.go +++ b/src/http.go @@ -67,6 +67,10 @@ func registerPostHandler(w http.ResponseWriter, r *http.Request) { return } + if !isValid(username) { + indexHander(w, r) + } + // add the new username to the list of usernames usernames = append(usernames, username) @@ -107,6 +111,13 @@ func isUniq(username string) bool { return true } +func isValid(username string) bool { + if username == "traefik" || username == "register" { + return false + } + return true +} + func readFileToReponse(w http.ResponseWriter, path string) { requestedFile := strings.Replace(path, "..", "", -1) -- cgit 1.4.1