pingcap / pingcap/tidb

Privilege required to run ALTER INSTANCE RELOAD TLS is too high

Open
#50,680 2 comments 0 reactions 0 assignees View on GitHub
compatibility-mysql80 sig/sql-infra type/feature-request
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```sql
% mysql -h 127.0.0.1 -P4000 -u root

mysql> create user 'jack'@'%' identified by 'tidb';
Query OK, 0 rows affected (0.01 sec)

mysql> grant connection_admin on *.* to 'jack'@'%';
Query OK, 0 rows affected (0.01 sec)

mysql> exit

% mysql -h 127.0.0.1 -P4000 -u jack -p

mysql> ALTER INSTANCE RELOAD TLS;
ERROR 1227 (42000): SUPER
mysql> exit

% mysql -h 127.0.0.1 -P4000 -u root

mysql> grant super on *.* to 'jack'@'%';
Query OK, 0 rows affected (0.01 sec)

mysql> exit

% mysql -h 127.0.0.1 -P4000 -u jack -p

mysql> ALTER INSTANCE RELOAD TLS;
Query OK, 0 rows affected (0.58 sec)

mysql> exit
```
### 2. What did you expect to see? (Required)

There is no Tidb document explain what privilege is required to run ALTER INSTANCE RELOAD TLS.

Per mysql document: https://dev.mysql.com/doc/refman/8.0/en/alter-instance.html

> ALTER INSTANCE RELOAD TLS
This action reconfigures a TLS context from the current values of the system variables that define the context. It also updates the status variables that reflect the active context values. This action requires the **CONNECTION_ADMIN** privilege.

### 3. What did you see instead (Required)

But in TiDB, only **CONNECTION_ADMIN** is not enough. **SUPER** is required to run this command.

There are 2 issues here:
1. It is not compatible with mysql.
2. DBA have to grant **SUPER** privilege, give database user to much privileges.

### 4. What is your TiDB version? (Required)

tidb_version(): Release Version: v7.5.0
Edition: Community
Git Commit Hash: 069631e2ecfedc000ffb92c67207bea81380f020
Git Branch: heads/refs/tags/v7.5.0
UTC Build Time: 2023-11-24 08:50:14
GoVersion: go1.21.3
Race Enabled: false
Check Table Before Drop: false
Store: tikv

Contributor guide

Open the contributing guide

Research direction

Start with the ALTER INSTANCE RELOAD TLS privilege check and reproduce the reported SQL sequence using CONNECTION_ADMIN without SUPER. Compare the behavior with the linked MySQL ALTER INSTANCE documentation; done means the command succeeds with CONNECTION_ADMIN alone and coverage verifies that SUPER is not required.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, mysql, sql
Domain
authorization, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.