@@ -10,14 +10,32 @@ private import semmle.python.dataflow.new.RemoteFlowSources
1010private import experimental.semmle.python.Concepts
1111private import semmle.python.ApiGraphs
1212
13+ /**
14+ * Provides models for Python's ldap-related libraries.
15+ */
1316private module LDAP {
17+ /**
18+ * Provides models for Python's `ldap` library.
19+ *
20+ * See https://www.python-ldap.org/en/python-ldap-3.3.0/index.html
21+ */
1422 private module LDAP2 {
23+ /**
24+ * List of `ldap` methods used to execute a query.
25+ *
26+ * See https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap.html#functions
27+ */
1528 private class LDAP2QueryMethods extends string {
1629 LDAP2QueryMethods ( ) {
1730 this in [ "search" , "search_s" , "search_st" , "search_ext" , "search_ext_s" ]
1831 }
1932 }
2033
34+ /**
35+ * A class to find `ldap` methods executing a query.
36+ *
37+ * See `LDAP2QueryMethods`
38+ */
2139 private class LDAP2Query extends DataFlow:: CallCfgNode , LDAPQuery:: Range {
2240 DataFlow:: Node ldapNode ;
2341
@@ -41,6 +59,11 @@ private module LDAP {
4159 override DataFlow:: Node getLDAPNode ( ) { result = ldapNode }
4260 }
4361
62+ /**
63+ * A class to find calls to `ldap.dn.escape_dn_chars`.
64+ *
65+ * See https://github.com/python-ldap/python-ldap/blob/7ce471e238cdd9a4dd8d17baccd1c9e05e6f894a/Lib/ldap/dn.py#L17
66+ */
4467 private class LDAP2EscapeDNCall extends DataFlow:: CallCfgNode , LDAPEscape:: Range {
4568 LDAP2EscapeDNCall ( ) {
4669 this = API:: moduleImport ( "ldap" ) .getMember ( "dn" ) .getMember ( "escape_dn_chars" ) .getACall ( )
@@ -49,6 +72,11 @@ private module LDAP {
4972 override DataFlow:: Node getEscapeNode ( ) { result = this .getArg ( 0 ) }
5073 }
5174
75+ /**
76+ * A class to find calls to `ldap.filter.escape_filter_chars`.
77+ *
78+ * See https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap-filter.html#ldap.filter.escape_filter_chars
79+ */
5280 private class LDAP2EscapeFilterCall extends DataFlow:: CallCfgNode , LDAPEscape:: Range {
5381 LDAP2EscapeFilterCall ( ) {
5482 this =
@@ -59,7 +87,15 @@ private module LDAP {
5987 }
6088 }
6189
90+ /**
91+ * Provides models for Python's `ldap3` library.
92+ *
93+ * See https://pypi.org/project/ldap3/
94+ */
6295 private module LDAP3 {
96+ /**
97+ * A class to find `ldap3` methods executing a query.
98+ */
6399 private class LDAP3Query extends DataFlow:: CallCfgNode , LDAPQuery:: Range {
64100 DataFlow:: Node ldapNode ;
65101
@@ -79,6 +115,11 @@ private module LDAP {
79115 override DataFlow:: Node getLDAPNode ( ) { result = ldapNode }
80116 }
81117
118+ /**
119+ * A class to find calls to `ldap3.utils.dn.escape_rdn`.
120+ *
121+ * See https://github.com/cannatag/ldap3/blob/4d33166f0869b929f59c6e6825a1b9505eb99967/ldap3/utils/dn.py#L390
122+ */
82123 private class LDAP3EscapeDNCall extends DataFlow:: CallCfgNode , LDAPEscape:: Range {
83124 LDAP3EscapeDNCall ( ) {
84125 this =
@@ -92,6 +133,11 @@ private module LDAP {
92133 override DataFlow:: Node getEscapeNode ( ) { result = this .getArg ( 0 ) }
93134 }
94135
136+ /**
137+ * A class to find calls to `ldap3.utils.conv.escape_filter_chars`.
138+ *
139+ * See https://github.com/cannatag/ldap3/blob/4d33166f0869b929f59c6e6825a1b9505eb99967/ldap3/utils/conv.py#L91
140+ */
95141 private class LDAP3EscapeFilterCall extends DataFlow:: CallCfgNode , LDAPEscape:: Range {
96142 LDAP3EscapeFilterCall ( ) {
97143 this =
0 commit comments