Quote and escape values in generated mysql option file - #672
Merged
Merged
Conversation
JillRegan
approved these changes
Sep 24, 2026
Open
1 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
configFileEntrywrote values into the generatedmy.cnfverbatim, but MySQL's option-file parser treats#as starting a comment anywhere on a line, so a password of#4bbecamepassword=#4band was read back as empty — the client authenticated with no password and the server answeredERROR 1045 (28000): Access denied ... (using password: NO). Backslashes, surrounding whitespace, pre-quoted values and line breaks were corrupted the same way, across all five fields, and every case failed silently.Values are now quoted with backslashes, double quotation marks and line breaks escaped; since that changes ordinary values too, the expected provisioner output moves to its own fixture (
provision.cnf) andmysql.cnfstays unquoted as the file the importer reads.Type of change
Related Issue(s)
How To Test
Unit tests, including a regression test for the reported bug:
go test ./plugins/mysql/ -vTestConfigFileEntryRoundTripsThroughMySQLasserts that the value the client reads back out of the generated file equals the value the item holds, across 21 values covering #, backslashes, whitespace, line breaks and pre-quoted values. It checks the round trip rather than the exact file text because MySQL accepts more than one correct encoding.End to end with the CLI, using the password from the issue:
This failed with Access denied ... (using password: NO) before the change and should now connect.
back\slashand a password with a trailing space are worth trying too.Changelog
The MySQL plugin now quotes and escapes the values it writes to the generated
my.cnf, so passwords containing #, backslashes, or surrounding whitespace no longer fail to authenticate.