| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| class EscapeSanitizer extends DataFlow::Node { | ||
| EscapeSanitizer() { | ||
| exists(Call c | | ||
| ( | ||
| // avoid flow through any %escape% function | ||
| c.getFunc().(Attribute).getName().matches("%escape%") or // something.%escape%() | ||
| c.getFunc().(Name).getId().matches("%escape%") // %escape%() | ||
| ) and | ||
| this.asExpr() = c | ||
| ) | ||
| } | ||
| } |
There was a problem hiding this comment.
Pending refactor. (Pending decision -> covering the specific methods of the libs or matching %sanitize% like this)
Sorry, something went wrong.
There was a problem hiding this comment.
Not sure how the CodeQL team feels about it but if there are cases where a CodeQL query developer thinks that data is going to be sanitized by a sanitize-type function, should the FilterOrDNSanitizationCall predicate be extracted out so that it can be used in other queries and not just the LDAP Injection vulnerabilities?
Sorry, something went wrong.
| | ldap3_bad.py:18:28:18:40 | ControlFlowNode for unsafe_filter | ldap3_bad.py:13:27:13:33 | ControlFlowNode for request | ldap3_bad.py:18:28:18:40 | ControlFlowNode for unsafe_filter | $@ LDAP query parameter comes from $@. | ldap3_bad.py:18:28:18:40 | ControlFlowNode for unsafe_filter | This | ldap3_bad.py:13:27:13:33 | ControlFlowNode for request | a user-provided value | | ||
| | ldap3_bad.py:18:28:18:40 | ControlFlowNode for unsafe_filter | ldap3_bad.py:14:35:14:41 | ControlFlowNode for request | ldap3_bad.py:18:28:18:40 | ControlFlowNode for unsafe_filter | $@ LDAP query parameter comes from $@. | ldap3_bad.py:18:28:18:40 | ControlFlowNode for unsafe_filter | This | ldap3_bad.py:14:35:14:41 | ControlFlowNode for request | a user-provided value | |
There was a problem hiding this comment.
Refer to this discussion about the repeated result regarding unsafe_filter.
Sorry, something went wrong.
There was a problem hiding this comment.
Overall this looks like fine port of the query from Java/C#.
There are some minor things I would clean up before promoting this from experimental (like the examples for how proper escaping should look like being functional), but overall the code looks ok.
I'll get in touch privately to see how to we should proceed form here, since I know you're busy at the moment 👍
Sorry, something went wrong.
There was a problem hiding this comment.
The other minor things you could look at before we merge this PR is:
Just FYI, as discussed in #5680 (comment), you don't need to suffix everything with Node. For example, I would probably have called LDAPQuery.getLDAPNode for LDAPQuery.getQuery() (since just calling it LDAPQuery.getLDAP seems wrong), and LDAPEscape.getEscapeNode for LDAPEscape.getAnInput (again, since LDAPEscape.getEscape sounds strange)... but this is clearly just nitpicks, and something that will be easy to do if we promote this query out of experimental.
Sorry, something went wrong.
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
|
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for making those last changes 👍 Besides fixing up the example of how to use escaping, and a few QLDocs that could be slightly improved, I think this PR looks good 💪
Sorry, something went wrong.
Co-authored-by: Rasmus Wriedt Larsen <rasmuswriedtlarsen@gmail.com>
There was a problem hiding this comment.
Thanks for working through the last few things, I've resolved the merge conflict and made the autoformatter happy, so now we can merge this query 💪
Sorry, something went wrong.
Thanks for the fix and the merge :) |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Any suggestions/tricks to improve the query or workarounds (to learn), no matter how minimal they are, are massively appreciated.