-
-
Notifications
You must be signed in to change notification settings - Fork 639
Add mysql_clear_password auth plugin #1403
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
Add mysql_clear_password auth plugin #1403
Conversation
yeah, this was discussed few times. I'm keen to have it included, thanks for working on this @rathboma ! Not sure if I want to have
also would be good to add an integration test ( I guess that would require creating a new |
Yeah honestly I had no idea how to test it! Ok I'll take the approach you suggest and see if I can figure testing out. |
what's your opinion on risk vs convenience of having |
I'm struggling with the same question in my app to be honest. It's not enabled by default in the c library, so my gut is that it should throw an error but say that it can be enabled by setting a flag to true. Then also put it in the docs so it appears for google searchers. That seems like the most sensible to me? I think that's the approach I'm going to take for Beekeeper. |
I'm leaning towards the same. I'm not sure how common this auth type is in the wild and how inconvenient would it be to require some actions from a user to enable but I feel it's safer approach ( and more future proof - we can make it default in the future without breaking anything but not the other way around ) |
note that |
This is 'mysql_old_password' looks like? Probably lack of support is turning some folks away. So thanks for the heads up! |
yes, and potentially if we want to implement it probably should be part of normal handshake, not auth_switch/plugins as likely is used with legacy servers that might not support plugin auth. I see it as relatively low priority but would be good to add eventually |
'use strict' | ||
|
||
module.exports = pluginOptions => ({ connection, command }) => { | ||
const password = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a safety check we could add here if (!connection.config.insecureAuth) { throw new Error(...)}
not sure if its worth having two different flag names - insecureAuth
for mysql_old_password
and something else for mysql_clear_password
or one is enough
see
node-mysql2/lib/connection_config.js
Line 90 in 21ad545
this.insecureAuth = options.insecureAuth || false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not expect that the insecureAuth
be tied to anything but the pre-4.2 authentication. It is an inverse of the secure_auth
system variable for configuring the MySQL server to allow using mysql_old_password
on a MySQL 5.6 or earlier installation.
@rathboma just following up on this PR. Is this good to go? |
@rathboma @sidorares Can this PR be merged yet? |
@sidorares Just following up on this. Is there something that needs to be done to get this merged? |
@silverbullettruck2001 the change itself looks good for me to be added however really would like to see an integration test. The script would need to use standard root credentials to create another clear_password user and then make a second connection as that user |
@rathboma are you able to add those integration tests? |
I'm also on this. Can this PR be merged? |
I did tests - changes here doesn't work. The password sould be returned as a function, not the password itself. diff --git a/lib/auth_plugins/mysql_clear_password.js b/lib/auth_plugins/mysql_clear_password.js
index 0a13828..31ad40e 100644
--- a/lib/auth_plugins/mysql_clear_password.js
+++ b/lib/auth_plugins/mysql_clear_password.js
@@ -4,5 +4,5 @@ module.exports = pluginOptions => ({ connection, command }) => {
const password =
command.password || pluginOptions.password || connection.config.password;
- return Buffer.from(`${password}\0`)
-};
\ No newline at end of file
+ return () => Buffer.from(`${password}\0`)
+}; |
@sidorares How do you want to proceed with this? @rathboma doesn't seem to be responding this and we cannot update this PR to reflect the necessary changes. I can create a new branch with the changes and then create a new PR if that's what is needed to complete this? @tkchk could you provide the tests that you did to verify that this wasn't working so I can include them in my PR? |
Hey! Sorry I've been super slammed lately. I want to do this but not sure I have time in the next few weeks, if someone wants to take over the fork to push it through, please do. Matthew |
@rathboma do you want to give me access to the fork to get the changes made? I don't believe I have permissions on your fork to commit any changes. |
@silverbullettruck2001 if you want to continue you don't need @rathboma permission - just pull his branch:
and just create another PR and reference this one. The initial commit history will be preserved and will show @rathboma as an author |
@sidorares thanks for the suggestion! I went ahead and followed your suggestion and created a new branch and have a PR created for this: I don't have any tests included as I was hoping to get the tests from @tkchk as I am not familiar with building tests. If I don't hear back from him I may try taking a stab at it though to get this across the finish line. |
Sure. This is what I get with this PR unchanged.
|
@silverbullettruck2001 this is my test script
|
any news? |
@tkchk I merged @summer-wu fix, can you try master again? |
This seems like it comes up fairly frequently here (and has come up on my repo too, so figured I'd add this as a core supported plugin.
Not sure if you want to do this or not, but figured I'd open a PR just to see. Seems like a simple fix.
Let me know!