pingcap / pingcap/tidb

information_schema.statements_summary_history allows unauthorized data access

Open
#64,029 2 comments 0 reactions 0 assignees View on GitHub
contribution severity/minor sig/sql-infra type/bug
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)

```
-- connect as root
CREATE USER foo;

-- connect as foo
SELECT SUMMARY_BEGIN_TIME, SUMMARY_END_TIME, SAMPLE_USER, QUERY_SAMPLE_TEXT
FROM information_schema.statements_summary_history
WHERE SAMPLE_USER='root';
```
### 2. What did you expect to see? (Required)
```
MySQL [(none)]> SELECT SUMMARY_BEGIN_TIME, SUMMARY_END_TIME, SAMPLE_USER, QUERY_SAMPLE_TEXT
-> FROM information_schema.statements_summary_history
-> WHERE SAMPLE_USER='root';
Empty set (0.001 sec)
```
### 3. What did you see instead (Required)
```
MySQL [(none)]> SELECT SUMMARY_BEGIN_TIME, SUMMARY_END_TIME, SAMPLE_USER, QUERY_SAMPLE_TEXT
-> FROM information_schema.statements_summary_history
-> WHERE SAMPLE_USER='root';
+---------------------+---------------------+-------------+----------------------------------+
| SUMMARY_BEGIN_TIME | SUMMARY_END_TIME | SAMPLE_USER | QUERY_SAMPLE_TEXT |
+---------------------+---------------------+-------------+----------------------------------+
| 2025-10-18 04:00:00 | 2025-10-18 04:30:00 | root | select @@version_comment limit 1 |
+---------------------+---------------------+-------------+----------------------------------+
1 row in set (0.001 sec)
```
### 4. What is your TiDB version? (Required)

```
Release Version: v9.0.0-beta.1
Edition: Community
Git Commit Hash: 7aff918dcbfa6facf2adef9ade9961c40f217421
Git Branch: HEAD
UTC Build Time: 2025-03-24 09:09:55
GoVersion: go1.23.7
Race Enabled: false
Check Table Before Drop: false
Store: unistore
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.