Skip to content

Fix #19841 - Strip port from host when linking to user privileges in processes list#20315

Open
roadhero wants to merge 2 commits into
phpmyadmin:QA_5_2from
roadhero:fix/19841-processes-link-users
Open

Fix #19841 - Strip port from host when linking to user privileges in processes list#20315
roadhero wants to merge 2 commits into
phpmyadmin:QA_5_2from
roadhero:fix/19841-processes-link-users

Conversation

@roadhero

Copy link
Copy Markdown

Description

The Host field in SHOW PROCESSLIST includes the client's TCP port
(e.g., localhost:64776). This value was passed directly as the
hostname parameter 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_host key to the process row array in
Processes::getList(). The value is the host with any trailing :port
suffix stripped via preg_replace('/:\d+$/', '', $host). The template
uses row.user_host for the privileges link URL, while row.host
(unchanged) continues to populate the Host column display.

Fixes #19841.


Before submitting pull request, please review the following checklist:

  • Make sure you have read our CONTRIBUTING.md document.
  • Make sure you are making a pull request against the correct branch. For example, for bug fixes in a released version use the corresponding QA branch and for new features use the master branch. If you have a doubt, you can ask as a comment in the bug report or on the mailing list.
  • Every commit has proper Signed-off-by line as described in our DCO. This ensures that the work you're submitting is your own creation.
  • Every commit has a descriptive commit message.
  • Every commit is needed on its own, if you have just minor fixes to previous commits, you can squash them.
  • Any new functionality is covered by tests.

@williamdes williamdes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you !

@williamdes

Copy link
Copy Markdown
Member

Can you fix the test failure ?
https://github.com/phpmyadmin/phpmyadmin/actions/runs/26366858797/job/77685164475?pr=20315#step:6:671

@roadhero roadhero force-pushed the fix/19841-processes-link-users branch from 21e9dae to 0b604a1 Compare May 25, 2026 12:35
@ibennetch

Copy link
Copy Markdown
Member

This seems like a great improvement, thank you.

roadhero added 2 commits May 25, 2026 15:52
…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>
@roadhero roadhero force-pushed the fix/19841-processes-link-users branch from 0b604a1 to 5448398 Compare May 25, 2026 14:52
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.

3 participants