Fix #19841 - Strip port from host when linking to user privileges in processes list#20315
Open
roadhero wants to merge 2 commits into
Open
Fix #19841 - Strip port from host when linking to user privileges in processes list#20315roadhero wants to merge 2 commits into
roadhero wants to merge 2 commits into
Conversation
Member
|
Can you fix the test failure ? |
21e9dae to
0b604a1
Compare
Member
|
This seems like a great improvement, thank you. |
…ileges in processes list The Host column of SHOW PROCESSLIST contains the client connection address in "hostname:port" format (e.g., localhost:64776). Passing this directly as the hostname URL parameter to /server/privileges causes the user lookup to fail, since mysql.user.Host stores bare hostnames without port numbers. Strip the trailing port suffix before building the privileges link URL. The Host column display is unchanged. Signed-off-by: Dennis Vorobyov <roadhero@gmail.com>
…ses privileges link Update the processlist test fixture to use a host with a port suffix (Host1:12345) and assert that the rendered privileges link URL contains the bare hostname while the Host column display retains the full value. Signed-off-by: Dennis Vorobyov <roadhero@gmail.com>
0b604a1 to
5448398
Compare
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.
Description
The Host field in
SHOW PROCESSLISTincludes the client's TCP port(e.g.,
localhost:64776). This value was passed directly as thehostnameparameter when building the link to a user's privileges page.The privileges page queries
mysql.user WHERE Host = 'localhost:64776',which never matches — the user table stores bare hostnames without ports.
This change adds a
user_hostkey to the process row array inProcesses::getList(). The value is the host with any trailing:portsuffix stripped via
preg_replace('/:\d+$/', '', $host). The templateuses
row.user_hostfor the privileges link URL, whilerow.host(unchanged) continues to populate the Host column display.
Fixes #19841.
Before submitting pull request, please review the following checklist:
Signed-off-byline as described in our DCO. This ensures that the work you're submitting is your own creation.