-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Fix query template issues for bulk load #41078
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
Conversation
…a_options directly, preventing unwanted quotes around strings Refactored SQL command to interpolate duplicate_key_handling and extra_options directly, preventing unwanted quotes around strings.
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
hussein-awala
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a unit test for this change?
|
@eladkal anything else missing from my side to get this approved? it's my first PR here so i'm not sure what's the process |
potiuk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one introduces a security issue (one that #33328 attempted to prevent).
We absolutely cannot build an SQL query with interpolated value that can be provided from outside - this opens up all kind of possible manipulations with the query that might lead to a number of security issues.
The only way we can accept such a change if it actually checks allowed values for duplicate_key_handling and raises an exception it's not strictly one of the two values expected.
|
Same with extra-options. This is classic SQL Injection and you have to find a way to sanitize the input in the way that it cannot be abused . |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
closes: #42061
Refactored SQL command to interpolate duplicate_key_handling and extra_options directly, preventing unwanted quotes around strings.
Since this change, custom bulk load in mysql is broken. that change made the strings to be inserted to the query with quotes which resulted SQL error from mysql.
(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''REPLACE' INTO TABLE my_table ''' at line 1");^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.