-
Notifications
You must be signed in to change notification settings - Fork 1.9k
C++: SqlPqxxTainted query searches for sql injections via pqxx connector to postgres #5842
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
|
Hi @japroc, Thank you for your contribution. We will find a reviewer for your query soon :) I took a quick and very high-level look at your query, and I think it looks good. One thing you need to change is to give your query a unique |
|
Nice, thanks! I also want to mention that i dont check namespace. It thought that this operation may be redundant. |
|
Thank you for the submission. I expect to review this PR next week. |
MathiasVP
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.
Thanks for your contribution, @aproc!
The PR looks super good, so I hope it's okay I commented on a few stylistic things. When these are fixed I'll happily merge your contribution :)
| import semmle.code.cpp.dataflow.TaintTracking | ||
| import DataFlow::PathGraph | ||
|
|
||
| predicate pqxxTransationClassNames(string class_name, string namespace) { |
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.
We use camelCalse for variables in QL.
cpp/ql/src/experimental/Security/CWE/CWE-089/SqlPqxxTainted.qhelp
Outdated
Show resolved
Hide resolved
cpp/ql/src/experimental/Security/CWE/CWE-089/SqlPqxxTainted.qhelp
Outdated
Show resolved
Hide resolved
Hi, @MathiasVP! Nice! I have made changes suggested by you. Thanks! |
Good point. I think it's a good idea to check for the namespace. Your solution sounds fine, but you might be able to simplify the implementation if you change the type of |
|
MathiasVP
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.
LGTM!
Hello!
The main goal of my PR it to add support of pqxx connector.
Right now there are only MyQSL and SQlite support. And it is based solely on function name.
Pqxx sink is a bit more complex, because functions like "exec" may lead to high false positive rate.
I basically reused existing SqlTainted query, and created a custom SqlPqxxTainted query. I think that pqxx support should be implemented in Security.qll, but i seems not so simple to overwrite the logic behind SqlTainted query and it's Taint Configuration. That is why i decides to create separate query. I have also added example file SqlPqxxTainted.c and SqlPqxxTainted.qhelp which almost completely repeats SqlTainted.qhelp.