Check nicks on the IRC listener with the HTTP API's rule (closes #142)
check / check (push) Waiting to run
check / check (push) Waiting to run
The nick rule moves from internal/handlers to internal/service as ValidNick, and the HTTP API and both IRC listener NICK paths call it. The IRC listener used to cut a nick to 32 bytes and accept anything else, so a nick with spaces such as "bob PRIVMSG #inj :hi" made the lines built from it read as another user's PRIVMSG. It now answers a nick the rule refuses with ERR_ERRONEUSNICKNAME (432), before and after registration, and keeps the nick as it was. Model: opus-5-5
This commit was merged in pull request #152.
This commit is contained in:
@@ -44,6 +44,18 @@ var validChannelRe = regexp.MustCompile(
|
||||
`^#[a-zA-Z0-9_\-]{1,63}$`,
|
||||
)
|
||||
|
||||
// validNickRe matches the nicks both transports accept: a
|
||||
// letter or _, then up to 31 letters, digits or
|
||||
// _-[]\^{}|`.
|
||||
var validNickRe = regexp.MustCompile(
|
||||
`^[a-zA-Z_][a-zA-Z0-9_\-\[\]\\^{}|` + "`" + `]{0,31}$`,
|
||||
)
|
||||
|
||||
// ValidNick reports whether validNickRe matches nick.
|
||||
func ValidNick(nick string) bool {
|
||||
return validNickRe.MatchString(nick)
|
||||
}
|
||||
|
||||
// Params defines the dependencies for creating a Service.
|
||||
type Params struct {
|
||||
fx.In
|
||||
|
||||
Reference in New Issue
Block a user