Skip to content

Possible race condition with truncated nicks #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
emersonveenstra opened this issue Jul 26, 2021 · 3 comments · Fixed by #75
Closed

Possible race condition with truncated nicks #74

emersonveenstra opened this issue Jul 26, 2021 · 3 comments · Fixed by #75

Comments

@emersonveenstra
Copy link

When a Client is given a nick that's longer than the server's allowed nick length, the server might silently truncate the nick. When RPL_WELCOME is sent, it changes the nick to the correct one.

However, if a user is using SASL, it emits the 'registered' event on either SASL failure or success, which is before RPL_WELCOME. So in the connect callback, if the user is using SASL, client.nick will still be the non-truncated nick. This is why things like matrix-org/matrix-appservice-irc#1393 are happening, the bridge assigns the value of client.nick in the connect callback and stores that for the duration of the connection.

I'm not entirely sure why it's emitting registered on SASL replies, since RPL_WELCOME will be sent no matter what.

@Mikaela
Copy link

Mikaela commented Jul 27, 2021

Is this also the cause of matrix-org/matrix-appservice-irc#27 (comment)?

@emersonveenstra
Copy link
Author

emersonveenstra commented Jul 27, 2021

@Mikaela I don't know Ergo as much as I should, but if it doesn't explicitly issue a NICK on connection when it forces the nick change, then yeah, probably.

@slingamn
Copy link

If I'm understanding the context correctly, this is correct and is actually quite likely to occur with Ergo, because of force-nick-equals-account. That is to say, in the default/recommended configuration of Ergo, if a user authenticates with SASL, the nick they sent with NICK is ignored and their account name is used instead. The server doesn't send a NICK command of its own to indicate this, and the client is expected to deduce it from 001 RPL_WELCOME.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants