@@ -98,86 +98,3 @@ private module Re {
9898 override DataFlow:: Node getRegexNode ( ) { result = regexNode }
9999 }
100100}
101-
102- /**
103- * Provides models for Python's ldap-related libraries.
104- */
105- private module LDAP {
106- /**
107- * Provides models for Python's `ldap` library.
108- *
109- * See https://www.python-ldap.org/en/python-ldap-3.3.0/index.html
110- */
111- private module LDAP2 {
112- /**
113- * List of `ldap` methods used to execute a query.
114- *
115- * See https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap.html#functions
116- */
117- private class LDAP2QueryMethods extends string {
118- LDAP2QueryMethods ( ) {
119- this in [ "search" , "search_s" , "search_st" , "search_ext" , "search_ext_s" ]
120- }
121- }
122-
123- /**
124- * A class to find `ldap` methods binding a connection.
125- *
126- * See `LDAP2QueryMethods`
127- */
128- class LDAP2Bind extends DataFlow:: CallCfgNode , LDAPBind:: Range {
129- DataFlow:: Node queryNode ;
130-
131- LDAP2Bind ( ) {
132- exists (
133- DataFlow:: AttrRead bindMethod , DataFlow:: CallCfgNode searchCall ,
134- DataFlow:: AttrRead searchMethod
135- |
136- this .getFunction ( ) = bindMethod and
137- API:: moduleImport ( "ldap" ) .getMember ( "initialize" ) .getACall ( ) =
138- bindMethod .getObject ( ) .getALocalSource ( ) and
139- bindMethod .getAttributeName ( ) .matches ( "%bind%" ) and
140- searchCall .getFunction ( ) = searchMethod and
141- bindMethod .getObject ( ) .getALocalSource ( ) = searchMethod .getObject ( ) .getALocalSource ( ) and
142- searchMethod .getAttributeName ( ) instanceof LDAP2QueryMethods and
143- (
144- queryNode = searchCall .getArg ( 2 ) or
145- queryNode = searchCall .getArgByName ( "filterstr" )
146- )
147- )
148- }
149-
150- override DataFlow:: Node getPasswordNode ( ) { result = this .getArg ( 1 ) }
151-
152- override DataFlow:: Node getQueryNode ( ) { result = queryNode }
153- }
154- }
155-
156- /**
157- * Provides models for Python's `ldap3` library.
158- *
159- * See https://pypi.org/project/ldap3/
160- */
161- private module LDAP3 {
162- /**
163- * A class to find `ldap3` methods binding a connection.
164- */
165- class LDAP3Bind extends DataFlow:: CallCfgNode , LDAPBind:: Range {
166- DataFlow:: Node queryNode ;
167-
168- LDAP3Bind ( ) {
169- exists ( DataFlow:: CallCfgNode searchCall , DataFlow:: AttrRead searchMethod |
170- this = API:: moduleImport ( "ldap3" ) .getMember ( "Connection" ) .getACall ( ) and
171- searchMethod .getObject ( ) .getALocalSource ( ) = this and
172- searchCall .getFunction ( ) = searchMethod and
173- searchMethod .getAttributeName ( ) = "search" and
174- queryNode = searchCall .getArg ( 1 )
175- )
176- }
177-
178- override DataFlow:: Node getPasswordNode ( ) { result = this .getArgByName ( "password" ) }
179-
180- override DataFlow:: Node getQueryNode ( ) { result = queryNode }
181- }
182- }
183- }
0 commit comments