tidb icon indicating copy to clipboard operation
tidb copied to clipboard

*: [security] neutralizes externally-controlled format DSN strings

Open dwisiswant0 opened this issue 1 year ago • 7 comments

What problem does this PR solve?

Issue Number: close 120f1346-e958-49d0-b66c-0f889a469540 (external)

Problem Summary:

TiDB uses Go MySQL Driver for connecting to MySQL servers. The Data Source Name (DSN) strings for describing database connections is not neutralized so they can escape and add new parameters to use as data source name.

What is changed and how it works?

  • Escape any untrusted input to connect by DSN strings.

Check List

Tests

  • [ ] Unit test
  • [ ] Integration test
  • [x] Manual test (add detailed scripts or steps below)
  • [ ] No code

Side effects

  • [ ] Performance regression: Consumes more CPU
  • [ ] Performance regression: Consumes more Memory
  • [ ] Breaking backward compatibility

Documentation

  • [ ] Affects user behaviors
  • [ ] Contains syntax changes
  • [ ] Contains variable changes
  • [ ] Contains experimental features
  • [ ] Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

Fix the issue of arbitrary file read via data source name injection (CVE-2022-3023).

dwisiswant0 avatar Aug 31 '22 03:08 dwisiswant0

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment. After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review. Reviewer can cancel approval by submitting a request changes review.

ti-chi-bot avatar Aug 31 '22 03:08 ti-chi-bot

CLA assistant check
All committers have signed the CLA.

sre-bot avatar Aug 31 '22 03:08 sre-bot

Welcome @dwisiswant0!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. :smiley:

ti-chi-bot avatar Aug 31 '22 03:08 ti-chi-bot

Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/c5f296b775fb7f01364b7e67591cb02de4ea5234

ti-chi-bot avatar Aug 31 '22 03:08 ti-chi-bot

/run-br-integration-tests

lance6716 avatar Sep 01 '22 03:09 lance6716

/run-integration-br-tests

lance6716 avatar Sep 01 '22 03:09 lance6716

@dwisiswant0: PR needs rebase.

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/test-infra repository.

ti-chi-bot avatar Sep 10 '22 09:09 ti-chi-bot

ping @dwisiswant0 , do you need some help?

lance6716 avatar Oct 08 '22 07:10 lance6716

ping @dwisiswant0 , do you need some help?

Since I didn't think about the complexity at first, I'm going to close this PR unfortunately.

dwisiswant0 avatar Oct 09 '22 05:10 dwisiswant0

ping @dwisiswant0 , do you need some help?

Since I didn't think about the complexity at first, I'm going to close this PR unfortunately.

We can fix it in our daily work. Can you verify that my comments in https://github.com/pingcap/tidb/pull/37489#discussion_r967035685 is safe enough?

lance6716 avatar Oct 09 '22 05:10 lance6716

ping @dwisiswant0 , do you need some help?

Since I didn't think about the complexity at first, I'm going to close this PR unfortunately.

We can fix it in our daily work. Can you verify that my comments in #37489 (comment) is safe enough?

In the context of verifying the patch, I'd prefer to test it directly for more flexibility from my side (something related e.g. bypass, etc). So feel free to ping me (in the future associated PR or 120f1346-e958-49d0-b66c-0f889a469540) whenever it's in a ready for review state. :)

dwisiswant0 avatar Oct 09 '22 06:10 dwisiswant0