Reputation: 7862
I have quick question. Is this code is vulnerable to SQL injection:
ActiveAdmin::SurveyPack.where("survey_schemas @> '{#{survey_schema}}'")
survey_schemas column is an array column in my rails app.
Upvotes: 0
Views: 113
Reputation: 1424
Please make it simple.
ActiveAdmin::SurveyPack.where("survey_schemas @> ARRAY[?]", survey_schema)
or
ActiveAdmin::SurveyPack.where("survey_schemas = ARRAY[?]", survey_schema)
Happy coding.
Upvotes: 2
Reputation: 951
short answer, yes.
from ActiveAdmin::SurveyPack.where("survey_schemas @> '{#{survey_schema}}'")
to ActiveAdmin::SurveyPack.where("survey_schemas @> '{?}'", survey_schema)
Upvotes: 1