Skip to content

Bug #44929 #92403 #110570: Fix tty password length handling#664

Open
gitliuhc wants to merge 1 commit into
mysql:trunkfrom
gitliuhc:fix-bug-44929-92403-110570-tty-password-length
Open

Bug #44929 #92403 #110570: Fix tty password length handling#664
gitliuhc wants to merge 1 commit into
mysql:trunkfrom
gitliuhc:fix-bug-44929-92403-110570-tty-password-length

Conversation

@gitliuhc

@gitliuhc gitliuhc commented Jun 4, 2026

Copy link
Copy Markdown

Summary

This patch fixes the interactive TTY password input handling in the mysql client.

The previous implementation used a fixed-size buffer for interactive -p password input. As a result, passwords longer than 79 bytes could not be handled correctly. This also affects long token-style credentials used in token-based authentication scenarios.

When such long credentials are provided via interactive -p input, the input may be truncated or otherwise not processed correctly, which can lead to authentication failure and misleading error messages, for example:
ERROR 9125 (HY000): An error occurred while validating the access token. Please acquire a new token and retry.

One possible workaround is to pass the password directly using the --password option. However, this is not ideal from a security perspective because the password may be exposed through shell history or process command-line visibility. In addition, the mysql client explicitly shows the following warning in this case:
mysql: [Warning] Using a password on the command line interface can be insecure.

Therefore, this patch improves the interactive -p input path so that longer passwords and token-style credentials can be handled more safely, without requiring users to pass sensitive credentials directly on the command line.

Related Bugs

  • Bug #44929
  • Bug #92403
  • Bug #110570

Changed File

  • sql-common/get_password.cc

Testing

Tested on:

  • Windows 11
  • Ubuntu 24.04

Test cases:

  • 79-byte password
  • 80-byte password
  • 81-byte password
  • 100-byte password
  • 128-byte password
  • 2391-byte token-style password

Both normal password-based authentication and long token-style credential input were tested.

OCA

I have an approved Individual OCA.

Review

I would appreciate your review and consideration of this patch. Please let me know if any changes are needed.

@mysql-oca-bot

Copy link
Copy Markdown

Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at https://oca.opensource.oracle.com/
Please make sure to include your MySQL bug system user (email) in the returned form.
Thanks

@gitliuhc

gitliuhc commented Jun 4, 2026

Copy link
Copy Markdown
Author

I have an approved Individual OCA.
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants