Skip to content

Fail authentication when server requests unknown authentication plugin #206

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

Merged
merged 1 commit into from
May 21, 2025

Conversation

clue
Copy link
Contributor

@clue clue commented May 20, 2025

This changeset ensures we properly fail authentication when the server requests an unknown authentication plugin:

$ php examples/01-query.php 
Error: Connection to mysql://test:***@localhost/test failed during authentication: Unknown authentication plugin "caching_sha2_password" requested by server

The feature itself is mostly limited to better debugging output to give downstream consumers a better understanding what's going on. For reference, the old error looks like this:

$ php examples/01-query.php 
Error: Connection to mysql://test:***@localhost/test failed during authentication: Client does not support authentication protocol requested by server; consider upgrading MySQL client (EACCES)

On top of this, this is really done in preparation to add proper authentication plugins, in particular the caching_sha2_password authentication mechanism used by default on MySQL 8+ as discussed in #112. Once this PR is merged, I'll file a follow-up to add caching_sha2_password support.

The affected code has 100% code coverage and has been tested against a number of (older) MySQL server versions. The tests confirm it should continue to work for legacy servers not using authentication plugins or newer MySQL server versions using the existing mysql_native_password authentication. We should probably follow-up on PR #196 to add more MySQL server versions to our test matrix.

Marking this as WIP until the unrelated test failures are addressed via #205. Merged.

Builds on top of #205
Refs #112

@clue clue added this to the v0.7.0 milestone May 20, 2025
@clue clue requested a review from WyriHaximus May 20, 2025 15:34
@clue clue changed the title [WIP] Fail authentication when server requests unknown authentication plugin Fail authentication when server requests unknown authentication plugin May 20, 2025
@clue
Copy link
Contributor Author

clue commented May 20, 2025

Rebased now that #205 has been merged, this is now ready for review :shipit:

Copy link
Member

@WyriHaximus WyriHaximus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@WyriHaximus WyriHaximus merged commit 9fadbde into friends-of-reactphp:0.7.x May 21, 2025
14 checks passed
@clue clue deleted the plugin-auth branch May 21, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants