-
Notifications
You must be signed in to change notification settings - Fork 72
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
Avoid protocol error on empty password auth switch #42
Conversation
Prior to this commit test_connection_error, which creates a connection with a username that doesn't exist and an empty password, was flaky on mysql 8. Sometimes it passed with the expected BaseConnectionError, but often it failed with a TRILOGY_PROTOCOL_VIOLATION. The source of the failure was `read_auth_switch_packet`, which only handles `mysql_native_password` and `caching_sha2_password`, whereas in the case of this failure the attempted auth switch was to `sha256_password`. I'm not entirely sure why we get an auth switch packet sometimes and an "access denied" error packet other times (I'm guessing it has something to do with mysql 8 changing the default auth plugin to a caching plugin, but that's really just a guess). But in the case of an empty password it seems like we can handle the switch just fine. We've done a similar password_length check in #21. With this commit test_connection_error passes consistently.
It's probably worth exploring that a bit more, but in the meantime maybe this change is fine 🤷🏻♂️ The same test with a password provided would probably still break though... I might be talking myself out of this change. I'll leave the PR open anyways because it contains information that might help debug further. |
Hm, okay so if I'm understanding you correctly:
It seems strange that MySQL 8.0 would change the default -- supposedly it's The real root of this problem seems to be that we're ending up with an unsupported As an aside: Even with the CI docker files I've yet to get the test to fail locally on my machine, which is certainly odd 🤔 (I've run it probably 20+ times) |
Yup, all of that matches my understanding.
Oops, I just clicked through your link. You've probably already seen those.
Saaaame. The fact that it's a caching plugin had me wondering whether there might be a different path based on whether it's a cache hit or miss, but based on https://dev.mysql.com/doc/dev/mysql-server/latest/page_caching_sha2_authentication_exchanges.html#sect_caching_sha2_info it seems like we should go down the same quick path every time if the password is empty. 🤷🏻♂️
I would think we'd go the other way, setting it to
Interesting! |
Yeah maybe that's a sensible fix in the meantime, to revert back to the 5.7 default. I didn't realize there were other ongoing issues with |
Closing since I don't think this is the right solution. To be continued in #43 |
Prior to this commit
test_connection_error
, which creates a connection with a username that doesn't exist and an empty password, was flaky on mysql 8. Sometimes it passed with the expected BaseConnectionError, but often it failed with aTRILOGY_PROTOCOL_VIOLATION
.The source of the
TRILOGY_PROTOCOL_VIOLATION
wasread_auth_switch_packet
, which only handlesmysql_native_password
andcaching_sha2_password
, whereas in the case of this failure the attempted auth switch was tosha256_password
.I'm not entirely sure why we get an auth switch packet sometimes and an "access denied" error packet other times (I'm guessing it has something to do with mysql 8 changing the default auth plugin to the caching plugin, but that's really just a guess). But in the case of an empty password it seems like we can handle the switch just fine. We've done a similar password_length check in #21.
With this commit test_connection_error passes consistently.