Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidb log redaction leaks raw keys to logs #59279

Open
HaoW30 opened this issue Feb 6, 2025 · 0 comments
Open

Tidb log redaction leaks raw keys to logs #59279

HaoW30 opened this issue Feb 6, 2025 · 0 comments
Assignees
Labels
sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@HaoW30
Copy link
Contributor

HaoW30 commented Feb 6, 2025

Bug Report

When tidb log redaction turned on. There are still messages in the log that contains the raw region key information which should have been sanitized.

1. Minimal reproduce step (Required)

  1. Turn on global log redaction
    mysql> SHOW VARIABLES LIKE 'tidb_redact_log';
    +-----------------+-------+
    | Variable_name | Value |
    +-----------------+-------+
    | tidb_redact_log | ON |
    +-----------------+-------+
    1 row in set (0.00 sec)

  2. Create new table and add dummy data.

CREATE TABLE users (
    id INT PRIMARY KEY AUTO_INCREMENT,
    name VARCHAR(50),
    email VARCHAR(100),
    age INT,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO users (name, email, age)
WITH RECURSIVE seq AS (SELECT 1 AS n UNION ALL SELECT n + 1 FROM seq WHERE n < 100)
SELECT CONCAT('User_', n), CONCAT('user', n, '@example.com'), FLOOR(18 + (RAND() * 42)) FROM seq;
  1. Check tidb logs, you will see the raw data key printed in region split messages.
[2025/02/06 09:39:12.644 -08:00] [INFO] [split_region.go:85] ["split batch regions request"] ["split key count"=1] ["batch count"=1] ["first batch, region ID"=48] ["first split key"=74800000000000006e]
[2025/02/06 09:39:12.650 -08:00] [INFO] [split_region.go:187] ["batch split regions complete"] ["batch region ID"=48] ["first at"=74800000000000006e] ["first new region left"="{Id:287 StartKey:7480000000000000ff6c00000000000000f8 EndKey:7480000000000000ff6e00000000000000f8 RegionEpoch:{ConfVer:5 Version:65} Peers:[id:288 store_id:1  id:289 store_id:5  id:290 store_id:4 ] EncryptionMeta:<nil> IsInFlashback:false FlashbackStartTs:0}"] ["new region count"=1]

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

All key values redacted.

3. What did you see instead (Required)

See the repro steps.

4. What is your TiDB version? (Required)

v6.5, v7.5, v8.1, v8.5

@HaoW30 HaoW30 added the type/bug The issue is confirmed as a bug. label Feb 6, 2025
@jebter jebter added the sig/sql-infra SIG: SQL Infra label Feb 8, 2025
@tangenta tangenta self-assigned this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

3 participants