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

mydumper: fix an 'SQL injection' issue when table name contains a ' or \ #168

Closed
wants to merge 1 commit into from

Conversation

kennytm
Copy link
Contributor

@kennytm kennytm commented Nov 28, 2018

In detect_generated_fields() and get_insertable_fields(), the query was constructed by printfing the database and table names without escaping. When these names contain a ' or \, the query would become invalid.

This PR fixes the issue by switching to use prepare statements, so that the SQL engine could automatically escape these strings.

In `detect_generated_fields()` and `get_insertable_fields()`, the query
was constructed by `printf`ing the database and table names without
escaping. When these names contain a `'` or `\`, the query would become
invalid.

This PR fixes the issue by switching to use prepare statements, so that
the SQL engine could automatically escape these strings.
@davidducos
Copy link
Member

Hi @kennytm,

With latest #399 merge, I think that this is not an issue anymore, can you confirm?

@kennytm kennytm closed this Sep 3, 2021
@kennytm kennytm deleted the kennytm/fix-tidb-8472 branch September 3, 2021 13:34
@davidducos davidducos changed the title mydumper: fix an "SQL injection" issue when table name contains a ' or \ mydumper: fix an 'SQL injection' issue when table name contains a ' or \ Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants