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

Ruby: refine ActiveRecord update_all as an SQL sink #14627

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

alexrford
Copy link
Contributor

@alexrford alexrford commented Oct 30, 2023

update_all calls sanitize_sql_for_assignment on array arguments which in turn calls sanitize_sql_array which takes ary[0] as the statement and ary[1..] as the values to use for bind variables in the statement. The values are sanitized before interpolation.

The statement itself is still vulnerable to injection of unsanitized data, and the method can also just take a string argument which may be tainted. It can also take a hash of field: value pairs which I believe to be sanitized by default, though another pair of eyes on this would be good.

@alexrford alexrford added the Ruby label Oct 30, 2023
@alexrford alexrford marked this pull request as ready for review October 30, 2023 12:43
@alexrford alexrford requested a review from a team as a code owner October 30, 2023 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant