SIGN IN SIGN UP

fix(mysql): repair caching_sha2_password fast-auth path (#4245)

The client-side scramble mixed the SHA-256 inputs in the wrong order, so
no spec-compliant MySQL server could validate it. Every connection fell
through to perform_full_authentication and the plugin's cache was never
exercised.

Two changes:

1. scramble_sha256 now hashes as SHA256(SHA256(SHA256(pw)) || nonce) to
   match the server's generate_sha2_scramble. Adds a unit test that
   simulates the server's XOR verification.

2. handle(..) returned true on fast_auth_success (0x01 0x03) without
   consuming the trailing OK_Packet, which then corrupted the next read.
   This was latent because 0x03 was never reached. It now yields back to
   the handshake loop so the OK is consumed by the existing 0x00 branch.

fixes #4244
M
Marcelo Altmann committed
5bd5531fdd458a3bca4aab35860203948153acb2
Parent: bfb8ff6
Committed by GitHub <noreply@github.com> on 4/28/2026, 1:09:54 AM