solanum-ircd / solanum

An IRCd for unified networks
https://solanum.chat/
GNU General Public License v2.0
225 stars 54 forks source link

Sanitize username early, and early reject invalid ones #434

Closed dwfreed closed 3 months ago

dwfreed commented 3 months ago

This ensures [ won't appear in the various rejection snotes, and invalid username characters only appear in the snote announcing their rejection.

Supersedes #433 and #381 Fixes #334

glguy commented 3 months ago

I believe that we need to test that the new [-free username is not empty now. Before the change I get "invalid username" trying this. After the change I seem to be able to get an empty username

dwfreed commented 3 months ago

Fixed by moving the valid_username test to after the sanitization. It'll look like they have an empty username in the snote, but that's no worse than it was before.