Skip to content

Access denied to "SHOW MASTER STATUS" #17454

@gs71

Description

@gs71

Describe the bug

A regular user cannot execute "SHOW MASTER/SLAVE STATUS", so every click on the "Databases" or "Status" tab produces 2 errors in the SQL error log (if enabled):

Access denied; you need (at least one of) the SUPER, BINLOG MONITOR privilege(s) for this operation : SHOW MASTER STATUS
Access denied; you need (at least one of) the SUPER, SLAVE MONITOR privilege(s) for this operation : SHOW SLAVE STATUS

To Reproduce

Steps to reproduce the behavior:

  1. Enable the SQL errors log ("sql_error_log_filename" variable)
  2. Login as user with limited privileges (not root) and click on the "Databases" or "Status" tab
  3. See errors in log file

Expected behavior

No errors in log file.

Server configuration

  • Operating system: Linux
  • Web server: Apache
  • Database version: MariaDB 10.6.7
  • PHP version: PHP 8.1.2
  • phpMyAdmin version: 5.3.0-dev+20220208.47252f9cf8

Client configuration

  • Browser: any
  • Operating system: any

Additional context

I think the bug could be fixed by checking for SuperUser access level in file libraries/classes/ReplicationInfo.php line 85, something like:

        if ($this->dbi->isSuperUser()) {
            $this->setPrimaryStatus();

            if (! empty($connection)) {
                $this->setMultiPrimaryStatus();

                if ($this->multiPrimaryStatus) {
                    $this->setDefaultPrimaryConnection($connection);
                    $urlParams['primary_connection'] = $connection;
                }
            }

            $this->setReplicaStatus();
            $this->setPrimaryInfo();
            $this->setReplicaInfo();
        } else {
            $this->primaryStatus = '?';
            $this->multiPrimaryStatus = '?';
            $this->replicaStatus = '?';
            $this->primaryInfo = ['status' => false];
            $this->replicaInfo = ['status' => false];
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA problem or regression with an existing featureaffects/5.2This issue or pull-request affects 5.2.x releases (and maybe further versions)confirmed/5.2This issue is confirmed to be reproduced on 5.2 at the time this label was sethas-prAn issue that has a pull request pending that may fix this issue. The pull request may be incompletepatch

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions