@@ 10,6 10,7 @@ import (
"log"
"net"
"net/http"
+ "regexp"
"strings"
"git.src.quest/~skye/felu-ddns/internal/db"
@@ 40,6 41,12 @@ func PostDomain() gin.HandlerFunc {
c.Abort()
return
}
+ // NOTE: I doubt doing a little regex here will matter, just the easiest for now.
+ if !regexp.MustCompile(`^[A-Za-z0-9]*$`).MatchString(data.Domain) {
+ c.String(http.StatusBadRequest, "Domain contains invalid chars")
+ c.Abort()
+ return
+ }
if net.ParseIP(data.ARecord).To4() == nil {
c.String(http.StatusBadRequest, "The A record is invalid")
c.Abort()