Skip to content

Bind parameters in where_object, where_object_changes#697

Merged
jaredbeck merged 3 commits intomasterfrom
fix_issue_696_sqli
Jan 18, 2016
Merged

Bind parameters in where_object, where_object_changes#697
jaredbeck merged 3 commits intomasterfrom
fix_issue_696_sqli

Conversation

@jaredbeck
Copy link
Copy Markdown
Member

Fixes #696

I don't have a lot of experience using postgres' json and jsonb through activerecord, but it looks like one can use placeholders, e.g.

User.where('preferences @> ?', {newsletter: true}.to_json)

So, I tried to replace string interpolation with placeholders, and it seems to fix #696

@jaredbeck
Copy link
Copy Markdown
Member Author

Note to self: I found "Using PostgreSQL and jsonb with Ruby on Rails" by Nando Vieira helpful while working on this.

jaredbeck added a commit that referenced this pull request Jan 18, 2016
Bind parameters in where_object, where_object_changes
@jaredbeck jaredbeck merged commit 3420c86 into master Jan 18, 2016
@jaredbeck jaredbeck deleted the fix_issue_696_sqli branch January 18, 2016 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant