Check nicks on the IRC listener with the HTTP API's rule (closes #142)
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:
2026-10-20 17:31:31 +02:00
parent eceb5f2b2c
commit 0b09cf838c
6 changed files with 96 additions and 15 deletions
+7 -2
View File
@@ -71,8 +71,13 @@ func (c *Conn) handleNick(
}
newNick := msg.Params[0]
if len(newNick) > maxNickLen {
newNick = newNick[:maxNickLen]
if !service.ValidNick(newNick) {
c.sendNumeric(
irc.ErrErroneusNickname,
newNick, "Erroneous nickname",
)
return
}
oldMask := c.hostmask()