Skip to content
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

coretasks: correctly abort SASL PLAIN on invalid server reply #2187

Merged
merged 1 commit into from
Oct 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions sopel/coretasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,14 +1059,17 @@ def auth_proceed(bot, trigger):
sasl_username = sasl_username or bot.nick

if mech == 'PLAIN':
if trigger.args[0] != '+':
# not an expected response from the server; abort SASL
token = '*'
else:
if trigger.args[0] == '+':
sasl_token = _make_sasl_plain_token(sasl_username, sasl_password)
LOGGER.info("Sending SASL Auth token.")
send_authenticate(bot, sasl_token)
return
return
else:
# Not an expected response from the server
# Send `authenticate-abort` command
# See https://ircv3.net/specs/extensions/sasl-3.1#the-authenticate-command
bot.write(('AUTHENTICATE', '*'))
return

# TODO: Implement SCRAM challenges

Expand Down