You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am writing an invoicing application which has required me to create a query builder for user searches on the database. Since I cannot know beforehand how many conditions a user will supply, my WHERE clauses must be written to a String before generating an sqlx::query from it. This means that my WHERE clauses are vulnerable to SQLi as you cannot bind to a String.
Thus, in order to use this query builder safely, I would need one of two things:
Query::push for mutable Query instances, so that I can add more to a Query and then bind my arguments.
String::bind (given the Database) so I can generate my string first and then call sqlx::query.
There may be another way around this that I am not thinking of, but in reading the docs I couldn't see how to either bind without a Query, nor amend a Query once formed.
I see that bind is very dependent on the ArgumentBuffers, so perhaps Query::push would be easier?
Thank you for reading this!
The text was updated successfully, but these errors were encountered:
Hello,
I am writing an invoicing application which has required me to create a query builder for user searches on the database. Since I cannot know beforehand how many conditions a user will supply, my
WHERE
clauses must be written to aString
before generating ansqlx::query
from it. This means that myWHERE
clauses are vulnerable to SQLi as you cannotbind
to aString
.Thus, in order to use this query builder safely, I would need one of two things:
Query::push
for mutableQuery
instances, so that I can add more to aQuery
and thenbind
my arguments.String::bind
(given theDatabase
) so I can generate my string first and then callsqlx::query
.There may be another way around this that I am not thinking of, but in reading the docs I couldn't see how to either
bind
without aQuery
, nor amend aQuery
once formed.I see that
bind
is very dependent on theArgumentBuffer
s, so perhapsQuery::push
would be easier?Thank you for reading this!
The text was updated successfully, but these errors were encountered: