Skip to content

log(all): add configurable TiCDC sensitive data redaction - #12270

Open
Tema wants to merge 1 commit into
pingcap:masterfrom
Tema:log-redaction
Open

Tema wants to merge 1 commit into
pingcap:masterfrom
Tema:log-redaction

Conversation

@Tema

@Tema Tema commented Aug 4, 2025 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

TiCDC diagnostics can expose row values, keys, DML arguments, and etcd values
containing changefeed credentials. Operators need an opt-in way to hide these
values or mark them for removal before sharing logs.

Issue Number: ref #859

What is changed and how it works?

  • Add cdc server --redact-info-log and [security].redact-info-log with OFF
    (false, default), ON (true, replace annotated content with ?), and MARKER
    ("MARKER", enclose content in ‹...›) modes. Explicit CLI flags override the
    configuration file. Preserve boolean/marker JSON and TOML representations.
  • Share the mode with TiDB's annotated errors and TiKV's existing key helpers.
    Annotate row values, keys/spans, scheduler messages and status maps, MySQL
    arguments, API query strings, and etcd values/watch events. Cover debug,
    warning, error, and panic paths, including input embedded in Avro year errors.
  • Format MARKER fields only when zap encodes them, so filtered entries skip
    formatting. Escape literal marker characters and retain the mode selected
    when each field was created. Avoid evaluating sensitive Stringers in ON mode.
  • Add configuration, serialization, dependency, real logging-path, SQL-error,
    and etcd-credential regressions plus a MySQL replication integration case.
    Document configuration, precedence, marker escaping, and coverage limits.

Parameterized DML templates and schema/table/column names remain readable;
arguments are protected separately. DDL and region error objects also remain
readable, so DDL DEFAULT literals can contain sensitive data. MARKER retains
sensitive values until its marked content is removed. This protects annotated
fields and does not guarantee that every third-party error or log is redacted.
TiKV's key helpers suppress keys in both ON and MARKER. DM retains its existing
setting. Restart TiCDC to change the configured mode.

The shared state and diagnostic choices align with
TiCDC's log-redaction implementation.

Check List

Tests

  • Unit test
  • Integration test (added; not run locally)

Passed locally with Go 1.26.9 on darwin/amd64, CGO enabled:

GOARCH=amd64 CGO_ENABLED=1 go build ./cdc/... ./pkg/... ./engine/pkg/orm
GOARCH=amd64 CGO_ENABLED=1 go test -tags=intest -race ./pkg/logutil/... -count=1 -timeout=5m
GOARCH=amd64 CGO_ENABLED=1 go test -p 3 -tags=intest -race ./pkg/config ./pkg/security ./pkg/orchestrator ./pkg/cmd/server -count=1 -timeout=10m
GOARCH=amd64 CGO_ENABLED=1 go test -p 2 -tags=intest ./cdc/sink/dmlsink/txn/mysql ./pkg/sqlmodel -count=1 -timeout=5m
GOARCH=amd64 CGO_ENABLED=1 go test -p 2 -tags=intest -race ./cdc/scheduler/internal/v3/agent ./cdc/scheduler/internal/v3/replication -count=1 -timeout=5m
GOARCH=amd64 CGO_ENABLED=1 TZ=Asia/Shanghai go test -p 3 -tags=intest ./cdc/entry ./cdc/scheduler/internal/v3/... ./cdc/processor/memquota ./cdc/processor/sourcemanager/sorter/... ./cdc/puller ./cdc/redo ./cdc/sink/dmlsink/txn/mysql ./cdc/sink/dmlsink/mq ./cdc/sink/tablesink ./cdc/api/middleware -count=1 -timeout=10m
tools/bin/failpoint-ctl enable cdc/kv pkg/version cdc/sink/dmlsink/blackhole cdc/model pkg/sqlmodel pkg/sink/codec/avro
GOARCH=amd64 CGO_ENABLED=1 go test -race -tags=intest ./cdc/sink/dmlsink/blackhole ./cdc/kv ./cdc/model ./pkg/sqlmodel ./pkg/sink/codec/avro -count=1
tools/bin/failpoint-ctl disable cdc/kv pkg/version cdc/sink/dmlsink/blackhole cdc/model pkg/sqlmodel pkg/sink/codec/avro
GOARCH=amd64 CGO_ENABLED=1 go vet -p 3 -tags=intest ./pkg/logutil/... ./pkg/cmd/server ./pkg/security ./pkg/orchestrator ./cdc/... ./pkg/sqlmodel ./pkg/sink/codec/avro ./engine/pkg/orm
make fmt
scripts/check-diff-line-width.sh
bash -n tests/integration_tests/log_redaction/run.sh tests/integration_tests/run_group.sh
tests/integration_tests/run_group.sh check others
git diff --check

KV, processor/sink-manager, and ORM suites also passed with their required
failpoints enabled. Temporary failpoint instrumentation was restored after the
suites.

The new MySQL replication case waits for unchanged downstream values, requires
real DML log entries, checks ON-mode absence across the log, and verifies escaped
MARKER arguments. Cluster binaries are unavailable locally, so it has not run.
Run it in a prepared integration environment with:

make integration_test_mysql CASE=log_redaction

Questions

Will it cause performance regression or break compatibility?

OFF is the default and preserves existing annotated field types and values. ON
and MARKER intentionally change annotated field content. MARKER defers work for
filtered entries; enabled logging still incurs formatting/escaping overhead.
The server option is opt-in and requires a restart to change modes. DM's existing
configuration is retained.

Do you need to update user documentation, design documentation or monitoring documentation?

Yes. Add docs/log-redaction.md and update the example server configuration.
The guide explains the modes, CLI precedence, shared dependency behavior,
readable SQL/DDL, marker handling, and coverage limits.

Release note

Add configurable TiCDC log redaction with OFF, ON, and MARKER modes for sensitive row values, keys, DML arguments, and etcd values.

Summary by CodeRabbit

  • New Features
    • Added configurable information-log redaction with OFF, ON, and MARKER modes. Settings can be provided in configuration or with the server’s --redact-info-log option; the command-line setting takes precedence.
    • Sensitive values in diagnostic logs—including keys, spans, queries, row data, and DML arguments—can now be masked or marked. Redaction is disabled by default.
  • Documentation
    • Added guidance on configuring redaction modes, their behavior, and coverage.

@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-linked-issue do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. labels Aug 4, 2025
@ti-chi-bot

ti-chi-bot Bot commented Aug 4, 2025

Copy link
Copy Markdown
Contributor

Hi @Tema. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot Bot added the needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. label Aug 4, 2025
@pingcap-cla-assistant

pingcap-cla-assistant Bot commented Aug 4, 2025 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot Bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. affect-ticdc-config-docs Pull requests that affect TiCDC configuration docs. area/dm Issues or PRs related to DM. area/engine Issues or PRs related to Dataflow Engine. labels Aug 4, 2025

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @Tema, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

I've implemented a robust log redaction system across all TiFlow components to enhance security and control over sensitive data in logs. This involved creating a new unified redaction package, integrating it into the existing logging infrastructure, and updating configuration mechanisms to support flexible redaction modes (OFF, ON, MARKER). I've applied these changes broadly to ensure sensitive information like database keys, queries, and URLs are properly masked, while maintaining backward compatibility for existing deployments. This work significantly improves data privacy and compliance without hindering debugging capabilities.

Highlights

  • Unified Log Redaction Framework: I've introduced a new unified log redaction package (pkg/logutil/redact) that provides core functionalities for redacting strings, keys, and values, supporting three distinct modes: OFF (no redaction), ON (replaces sensitive data with '?'), and MARKER (encloses sensitive data with '‹›' for later de-redaction).
  • Enhanced Logging Utilities: I've integrated the new redaction capabilities into the main logging utility (pkg/logutil), offering convenient functions like RedactString, RedactKey, and ZapRedactString to easily apply redaction when logging sensitive information.
  • Unified Configuration for Redaction Modes: I've updated the configuration systems for both TiCDC server (pkg/config/server_config.go) and DM worker (dm/worker/config.go) to use a new RedactInfoLogType. This allows users to configure log redaction via boolean values (true/false) or the string "MARKER" in TOML/JSON files and command-line flags, providing consistent behavior across components.
  • Broad Application of Redaction: I've systematically applied the new redaction functions across various TiFlow components (CDC, DM, Engine) to protect sensitive data such as database keys, DDL queries, API query parameters, Etcd keys, HTTP URLs, and SQL statements from being exposed in logs.
  • Backward Compatibility: I've ensured backward compatibility for existing DM configurations and logging calls, allowing a smooth transition to the new unified redaction system without breaking current deployments.
  • New Documentation and Testing: I've added comprehensive documentation (docs/log-redaction.md) detailing how to configure and use the new log redaction feature, including examples for each mode and guidance on de-redaction for debugging purposes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@ti-chi-bot ti-chi-bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Aug 4, 2025
@ti-chi-bot

Copy link
Copy Markdown
Member

Now you can start all CI jobs with /test all in comment or query the triggers with /test ?

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive and well-designed log redaction feature across the TiFlow project, which is a great improvement for security and data privacy. The implementation is thorough, covering various components like CDC, DM, and the engine, and correctly redacts sensitive information such as keys, queries, and URLs. The addition of different redaction modes (ON, OFF, MARKER) provides excellent flexibility for different environments. The new logutil packages are well-structured, and the inclusion of extensive unit and integration tests is commendable. I have a couple of minor suggestions to improve error handling and documentation style.

Comment thread cmd/dm-worker/main.go Outdated
Comment on lines 56 to 67
// Initialize log redaction using the unified RedactInfoLogType
err2 := logutil.InitLogRedactionFromType(cfg.RedactInfoLog)
if err2 != nil {
common.PrintLinesf("init log redaction error %s", terror.Message(err2))
os.Exit(2)
}

// For backward compatibility, also set DM's legacy redaction
log.SetRedactLog(cfg.RedactInfoLog != logutil.RedactInfoLogOFF)
if err != nil {
common.PrintLinesf("init logger error %s", terror.Message(err))
os.Exit(2)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error handling here can be improved for correctness and clarity:

  1. The error from log.InitLogger (line 51) should be checked immediately after the call, not after initializing redaction. This prevents running setup logic on a faulty state.
  2. A new variable err2 is introduced. It's cleaner to reuse the err variable.

A suggested refactoring would be to check err right after line 55, and then reuse err for the logutil.InitLogRedactionFromType call.

Comment thread docs/log-redaction.md Outdated
Convenience functions:
- `InitLogRedactionFromType(redactType RedactInfoLogType) error`: Initialize redaction from unified type
- `RedactString(s string) string`: Redact string with current settings
- `ZapRedactString(key, value string) zap.Field`: Create redacted zap field No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This file is missing a final newline character. It's a common convention and good practice to end all text files with a newline to prevent issues with some tools and scripts.

Add opt-in OFF, ON, and MARKER modes for annotated row values, keys,
DML arguments, scheduler messages, and etcd values. Share the mode with
TiDB errors and TiKV client logs while preserving default log behavior.

Defer marker formatting until field encoding, escape embedded markers,
and keep parameterized SQL templates readable. Preserve CLI precedence
and boolean/marker serialization, and protect inputs embedded in Avro
parse errors. Add real-path log regressions, a MySQL replication test,
and configuration documentation.

Related implementation: pingcap/ticdc#2919.
@ti-chi-bot

ti-chi-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign gmhdbjd for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

📝 Walkthrough

This change adds OFF, ON, and MARKER log redaction modes, exposes configuration through server settings, and adds redaction-aware Zap fields. It applies those fields to logs across TiCDC components and adds unit and integration tests for mode-specific output.

Changes: Configurable redaction

Layer / File(s) Summary
Redaction modes and Zap fields
pkg/logutil/redact/*, pkg/logutil/log.go, pkg/logutil/*_test.go
Adds OFF, ON, and MARKER modes and redaction-aware Zap fields for strings, arbitrary values, stringers, and string slices. Tests cover encoding, mode changes, lazy formatting, and shared redaction state.
Server configuration and documentation
pkg/security/credential.go, pkg/cmd/server/*, pkg/cmd/util/ticdc.toml, pkg/config/config_test_data.go, docs/log-redaction.md
Adds the redact-info-log setting and server flag. Server startup initializes redaction from the setting. Documentation describes the modes, configuration, coverage, and helper usage.

Redacted logging across components

Layer / File(s) Summary
CDC event, key, and span logs
cdc/api/middleware/*, cdc/entry/*, cdc/kv/*, cdc/model/*
Applies redaction-aware fields to query, key, row, column, and span logs. The mounter checksum mismatch path also changes its returned match result when skipFail is false.
Processor and sorter span logs
cdc/processor/*, cdc/puller/*, cdc/redo/*
Uses redaction-aware fields for spans and event values in processor, sink manager, sorter, puller, and redo manager logs.
Scheduler message and span logs
cdc/scheduler/internal/v3/*
Uses redaction-aware fields for scheduler messages, spans, tasks, statuses, and replication-set values.
Sink, codec, and SQL-value logs
cdc/sink/*, pkg/sink/codec/avro/*, pkg/sqlmodel/*, engine/pkg/orm/log.go
Redacts logged DML values, arguments, row data, spans, SQL traces, and SQL model diagnostics. Avro year-parse errors also redact the input embedded in the returned error.
Orchestrator and integration checks
pkg/orchestrator/*, tests/integration_tests/log_redaction/*, tests/integration_tests/run_group.sh
Redacts etcd payload and value logs. Adds tests for orchestrator output and an integration test that checks MySQL sink logs in all three modes.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ServerCommand
  participant RedactInfoLogType
  participant RedactionPackage
  participant ZapEncoder
  ServerCommand->>RedactInfoLogType: parse configured mode
  ServerCommand->>RedactionPackage: initialize global mode
  RedactionPackage->>RedactionPackage: create redaction-aware Zap field
  RedactionPackage->>ZapEncoder: encode value using field mode
Loading
Merge Risk: ⚪ Minimal · up to 132f6

No actionable merge-blocking issue is established. ON mode masks ORM SQL as documented, and checksum mismatch handling remains unchanged.

Security architecture risk: 🔵 Low · up to 132f6

The inspected changes reduce sensitive-value exposure without establishing a new authorization bypass or integrity regression. Protection remains annotation-based: MARKER mode retains plaintext, changing the configured mode requires a restart, and some dependency behavior remains unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The redaction authority is process-wide rather than tenant- or changefeed-specific. A mode selection therefore affects all consumers of the shared state in that process, including converted diagnostic fields and any dependency consumers that honor it. This is log-disclosure scope, not demonstrated acquisition of database or service privileges.

Security Findings and Attack Paths

  • observed — On the inspected HTTP and SQL logging paths, sensitive queries or arguments previously reached ordinary fields. ON now masks the converted values; OFF and MARKER intentionally retain them. No increased exposure was established for these paths. Unchanged direct error fields remain a coverage limitation rather than evidence of an introduced vulnerability.

Trust Boundaries and Controls

  • observed — Configuration validation precedes shared-mode publication. Unknown runtime mode values select full redaction, while empty state selects OFF. Marker rendering delegates escaping to TiDB, and tests specify doubling embedded marker characters. Redaction changes rendering rather than granting request authority.

Resilience and Maintainability Implications

  • observed — Each field captures its redaction decision at construction. Already-masked fields are not weakened by later mode changes, but raw fields are not retroactively masked. Concurrent mode changes could mix field decisions; the documented restart requirement and construction-time contract do not establish a supported live-transition confidentiality guarantee.
Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 31.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 38 functions across 50 files. (19 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: configurable sensitive-data redaction for TiCDC logs.
Description check Passed The description covers the required problem statement, issue reference, implementation details, tests, compatibility considerations, documentation updates, and release note.
Full details: Docstring Coverage

Explanation

Docstring coverage is 31.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 38 functions across 50 files. (19 skipped: 3 unsupported, 16 over the file limit.)

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the logs at night
And wraps each key from sight
OFF keeps values as they came
ON masks them all the same
MARKER leaves its sign in view
Then hops along with secrets few

Comment @coderabbitai help to get the list of available commands.

@Tema Tema changed the title [AI Generated] implement log redaction log(all): add configurable TiCDC sensitive data redaction Oct 13, 2026
@ti-chi-bot ti-chi-bot Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/needs-triage-completed and removed do-not-merge/needs-linked-issue do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Oct 13, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔇 Additional comments: 33
pkg/orchestrator/etcd_worker.go: 1

28-28: LGTM!

Also applies to: 224-224, 366-366

pkg/orchestrator/reactor_state.go: 1

26-26: LGTM!

Also applies to: 160-160, 432-432

pkg/orchestrator/reactor_state_test.go: 1

24-24: LGTM!

Also applies to: 28-28, 32-34, 723-762

pkg/logutil/redact/redact.go: 1

1-205: LGTM!

pkg/logutil/redact_type.go: 1

1-218: LGTM!

pkg/logutil/redact_type_test.go: 1

1-324: LGTM!

pkg/logutil/log.go: 1

19-19: LGTM!

Also applies to: 30-30, 354-373

pkg/logutil/log_redact_test.go: 1

1-261: LGTM!

pkg/logutil/redact/redact_test.go: 1

1-303: LGTM!

pkg/logutil/integration_test.go: 1

1-84: LGTM!

pkg/logutil/log_redact_dependencies_test.go: 1

1-61: LGTM!

pkg/security/credential.go: 1

26-26: LGTM!

Also applies to: 50-51

pkg/cmd/server/server.go: 1

73-74: LGTM!

Also applies to: 110-116, 207-208, 267-268

pkg/cmd/server/server_test.go: 1

26-26: LGTM!

Also applies to: 110-184

pkg/cmd/util/ticdc.toml: 1

37-38: LGTM!

pkg/config/config_test_data.go: 1

146-147: LGTM!

docs/log-redaction.md: 1

1-65: LGTM!

cdc/sink/dmlsink/blackhole/black_hole_dml_sink.go: 1

22-22: LGTM!

Also applies to: 43-43

cdc/sink/dmlsink/blackhole/log_redaction_test.go: 1

33-73: LGTM!

cdc/sink/dmlsink/mq/worker.go: 1

30-30: LGTM!

Also applies to: 142-142, 256-256

cdc/sink/dmlsink/txn/mysql/mysql.go: 1

230-230: LGTM!

Also applies to: 640-640, 667-667, 714-714

cdc/sink/dmlsink/txn/mysql/mysql_test.go: 1

106-211: LGTM!

cdc/sink/tablesink/progress_tracker.go: 1

312-312: LGTM!

cdc/sink/tablesink/table_sink_impl.go: 1

243-243: LGTM!

Also applies to: 261-261

pkg/sink/codec/avro/avro.go: 1

928-936: LGTM!

pkg/sink/codec/avro/confluent_schema_registry_test.go: 1

28-31: LGTM!

pkg/sink/codec/avro/log_redaction_test.go: 1

39-213: LGTM!

pkg/sqlmodel/multirow.go: 1

187-187: LGTM!

pkg/sqlmodel/multirow_redaction_test.go: 1

31-64: LGTM!

tests/integration_tests/log_redaction/conf/changefeed.toml: 1

1-2: LGTM!

tests/integration_tests/log_redaction/run.sh: 1

1-91: LGTM!

tests/integration_tests/run_group.sh: 1

14-14: LGTM!

engine/pkg/orm/log.go: 1

94-94: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Redacting the whole SQL string removes the ORM query template from logs.

logutil.ZapRedactString("sql", sql) replaces the complete SQL text with ? in ON mode. GORM's Trace callback supplies interpolated SQL, so the string can contain literal values. Redaction can be correct for this reason. The cost is that the slow-log and error-log entries no longer show which query ran, even when that query contains no sensitive literals. This behavior differs from the MySQL sink, which keeps templates readable. If you want the same troubleshooting value, log the statement type or a hash next to the redacted SQL. Otherwise, document that ORM SQL is fully redacted.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b051cd3e-f637-490e-8712-459521025e81
📥 Commits

Reviewing files that changed from the base of the PR and between 440328b and 132f698.

📒 Files selected for processing: 69
  • cdc/api/middleware/middleware.go
  • cdc/entry/mounter.go
  • cdc/kv/matcher.go
  • cdc/kv/matcher_redaction_test.go
  • cdc/kv/regionlock/region_range_lock.go
  • cdc/kv/shared_client.go
  • cdc/kv/shared_region_worker.go
  • cdc/model/sink.go
  • cdc/model/sink_redaction_test.go
  • cdc/processor/memquota/mem_quota.go
  • cdc/processor/processor.go
  • cdc/processor/sinkmanager/manager.go
  • cdc/processor/sinkmanager/redo_log_advancer.go
  • cdc/processor/sinkmanager/redo_log_worker.go
  • cdc/processor/sinkmanager/table_sink_advancer.go
  • cdc/processor/sinkmanager/table_sink_worker.go
  • cdc/processor/sinkmanager/table_sink_wrapper.go
  • cdc/processor/sinkmanager/tasks.go
  • cdc/processor/sourcemanager/sorter/memory/event_sorter.go
  • cdc/processor/sourcemanager/sorter/pebble/event_sorter.go
  • cdc/puller/multiplexing_puller.go
  • cdc/redo/manager.go
  • cdc/scheduler/internal/v3/agent/agent.go
  • cdc/scheduler/internal/v3/agent/agent_test.go
  • cdc/scheduler/internal/v3/agent/table.go
  • cdc/scheduler/internal/v3/agent/table_test.go
  • cdc/scheduler/internal/v3/coordinator.go
  • cdc/scheduler/internal/v3/keyspan/reconciler.go
  • cdc/scheduler/internal/v3/keyspan/splitter_region_count.go
  • cdc/scheduler/internal/v3/keyspan/splitter_write.go
  • cdc/scheduler/internal/v3/replication/replication_manager.go
  • cdc/scheduler/internal/v3/replication/replication_set.go
  • cdc/scheduler/internal/v3/replication/replication_set_test.go
  • cdc/scheduler/internal/v3/scheduler/scheduler_drain_capture.go
  • cdc/scheduler/internal/v3/scheduler/scheduler_manager.go
  • cdc/scheduler/internal/v3/scheduler/scheduler_move_table.go
  • cdc/sink/dmlsink/blackhole/black_hole_dml_sink.go
  • cdc/sink/dmlsink/blackhole/log_redaction_test.go
  • cdc/sink/dmlsink/mq/worker.go
  • cdc/sink/dmlsink/txn/mysql/mysql.go
  • cdc/sink/dmlsink/txn/mysql/mysql_test.go
  • cdc/sink/tablesink/progress_tracker.go
  • cdc/sink/tablesink/table_sink_impl.go
  • docs/log-redaction.md
  • engine/pkg/orm/log.go
  • pkg/cmd/server/server.go
  • pkg/cmd/server/server_test.go
  • pkg/cmd/util/ticdc.toml
  • pkg/config/config_test_data.go
  • pkg/logutil/integration_test.go
  • pkg/logutil/log.go
  • pkg/logutil/log_redact_dependencies_test.go
  • pkg/logutil/log_redact_test.go
  • pkg/logutil/redact/redact.go
  • pkg/logutil/redact/redact_test.go
  • pkg/logutil/redact_type.go
  • pkg/logutil/redact_type_test.go
  • pkg/orchestrator/etcd_worker.go
  • pkg/orchestrator/reactor_state.go
  • pkg/orchestrator/reactor_state_test.go
  • pkg/security/credential.go
  • pkg/sink/codec/avro/avro.go
  • pkg/sink/codec/avro/confluent_schema_registry_test.go
  • pkg/sink/codec/avro/log_redaction_test.go
  • pkg/sqlmodel/multirow.go
  • pkg/sqlmodel/multirow_redaction_test.go
  • tests/integration_tests/log_redaction/conf/changefeed.toml
  • tests/integration_tests/log_redaction/run.sh
  • tests/integration_tests/run_group.sh

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@ti-chi-bot

ti-chi-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

@Tema: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cdc-integration-mysql-test 132f698 link true /test pull-cdc-integration-mysql-test

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

affect-ticdc-config-docs Pull requests that affect TiCDC configuration docs. area/dm Issues or PRs related to DM. area/engine Issues or PRs related to Dataflow Engine. contribution This PR is from a community contributor. do-not-merge/needs-triage-completed first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants