fix(backend): disallow '.' and '..' in user and member names

This commit is contained in:
Sam 2023-05-12 01:09:02 +02:00
parent 0e9ac347c0
commit 4f43e32fdb
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
2 changed files with 28 additions and 11 deletions

View file

@ -38,6 +38,11 @@ const (
var memberNameRegex = regexp.MustCompile("^[^@\\?!#/\\\\[\\]\"\\{\\}'$%&()+<=>^|~`,]{1,100}$")
func MemberNameValid(name string) bool {
// These two names will break routing, but periods should still be allowed in names otherwise.
if name == "." || name == ".." {
return false
}
return memberNameRegex.MatchString(name)
}