pingcap / pingcap/tidb

Some audit logs has `CONNECTION_ID=0`

Open
#58,645 0 comments 0 reactions 0 assignees View on GitHub
may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major 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)

1. set up a cluster with enterprise version
2. login with wrong password

### 2. What did you expect to see? (Required)

All audit logs should have a `CONNECTION_ID` entry with a non-zero id.

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

We found a audit log with `CONNECTION_ID=0`

```
[2024/12/31 18:15:46.305 +08:00] [INFO] [ID=16b97472-796e-46d8-a111-a52b4a8b4646-0002] [EVENT="[CONNECTION,CONNECT]"] [USER=root] [ROLES="[]"] [CONNECTION_ID=2097164] [SESSION_ALIAS=] [TABLES="[]"] [STATUS_CODE=0] [REASON="[privilege:1045]Access denied for user 'root'@'127.0.0.1' (using password: YES)"] [CURRENT_DB=test] [CONNECTION_TYPE=TCP] [PID=55072] [SERVER_VERSION=v8.4.0-this-is-a-placeholder] [SSL_VERSION=] [HOST_IP=127.0.0.1] [HOST_PORT=4001] [CLIENT_IP=127.0.0.1] [CLIENT_PORT=59268] [AUTH_METHOD=mysql_native_password] [CONN_ATTRS="{\"_client_name\":\"pymysql\",\"_client_version\":\"1.1.1\",\"_pid\":\"71856\",\"program_name\":\"mycli\"}"]
[2024/12/31 18:15:46.306 +08:00] [INFO] [ID=16b97472-796e-46d8-a111-a52b4a8b4646-0003] [EVENT="[CONNECTION,DISCONNECT]"] [USER=root] [ROLES="[]"] [CONNECTION_ID=0] [SESSION_ALIAS=] [TABLES="[]"] [STATUS_CODE=1] [CONNECTION_TYPE=TCP] [PID=55072] [SERVER_VERSION=v8.4.0-this-is-a-placeholder] [SSL_VERSION=] [HOST_IP=127.0.0.1] [HOST_PORT=4001] [CLIENT_IP=127.0.0.1] [CLIENT_PORT=59268] [AUTH_METHOD=mysql_native_password] [CONN_ATTRS="{\"_client_name\":\"pymysql\",\"_client_version\":\"1.1.1\",\"_pid\":\"71856\",\"program_name\":\"mycli\"}"]
```

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

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.