fix: fix sha256_password to work correctly over a TLS connection#3809
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3809 +/- ##
==========================================
- Coverage 89.83% 89.78% -0.06%
==========================================
Files 86 86
Lines 13596 13605 +9
Branches 1606 1606
==========================================
+ Hits 12214 12215 +1
- Misses 1382 1390 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks, @viladimiru! I didn't get to test it in practice, but just bringing the quote in question here (the same applies to MySQL 8 and 9):
Also, regarding the missing tests, it is not actually related to this PR: this part of the logic was never covered. |
This comment was marked as resolved.
This comment was marked as resolved.
|
I believe that instead of relying on the configuration provided by the user ( const tls = require('tls');
// ...
if (
connection.stream instanceof tls.TLSSocket &&
connection.stream.encrypted === true
) {
// ...
Note Testing locally by forcing
|
Hi @wellwelwel! Thank you for the suggestion! Unfortunately, I'm not very knowledgeable about this particular issue, so if you think it's better this way, I will adjust the condition. |
When using By checking the connection itself, we can confirm that it is actually secure before sending data as plain text. |
|
Thanks again, @viladimiru! It's already available in |

After reading the MySQL documentation, I understood that the
sha256_passwordplugin works partially correctly, but it did not account for the fact that manual encryption is not required when connecting via TLS.documentation
Follow up for #2888