dont allow upercase chars in aliases (fix #192)

This commit is contained in:
Henry 2021-04-22 16:32:33 +02:00 committed by Henry
parent 2f0afe8f33
commit 9b4804b98e
1 changed files with 1 additions and 10 deletions

View File

@ -2,16 +2,12 @@
package aliases
import (
"fmt"
)
// IsValid decides whether an alias is okay for use or not.
// The room spec defines it as _labels valid under RFC 1035_ ( https://ssb-ngi-pointer.github.io/rooms2/#alias-string )
// but that can be mostly any string since DNS is a 8bit binary protocol,
// as long as it's shorter then 63 charachters.
//
// Right now it's pretty basic set of characters (a-z, A-Z, 0-9).
// Right now it's pretty basic set of characters (a-z, 0-9).
// In theory we could be more liberal but there is a bunch of stuff to figure out,
// like homograph attacks (https://en.wikipedia.org/wiki/IDN_homograph_attack),
// if we would decide to allow full utf8 unicode.
@ -30,11 +26,6 @@ func IsValid(alias string) bool {
continue
}
if char >= 'A' && char <= 'Z' { // is an ASCII upper-case char between a and z
continue
}
fmt.Println("found", char)
valid = false
break
}