@@ -6,7 +6,6 @@ import semmle.code.java.frameworks.UnboundId
66import semmle.code.java.frameworks.SpringLdap
77import semmle.code.java.frameworks.ApacheLdap
88
9-
109/** Holds if the parameter of `c` at index `paramIndex` is varargs. */
1110bindingset [ paramIndex]
1211predicate isVarargs ( Callable c , int paramIndex ) {
@@ -20,8 +19,8 @@ abstract class LdapInjectionSource extends DataFlow::Node { }
2019abstract class LdapInjectionSink extends DataFlow:: ExprNode { }
2120
2221/**
23- * A taint-tracking configuration for unvalidated user input that is used to construct LDAP queries.
24- */
22+ * A taint-tracking configuration for unvalidated user input that is used to construct LDAP queries.
23+ */
2524class LdapInjectionFlowConfig extends TaintTracking:: Configuration {
2625 LdapInjectionFlowConfig ( ) { this = "LdapInjectionFlowConfig" }
2726
@@ -79,7 +78,7 @@ class JndiLdapInjectionSink extends LdapInjectionSink {
7978 |
8079 m .getDeclaringType ( ) .getAnAncestor ( ) instanceof TypeDirContext and
8180 m .hasName ( "search" ) and
82- index in [ 0 .. 1 ]
81+ index in [ 0 .. 1 ]
8382 )
8483 }
8584}
@@ -129,16 +128,13 @@ class SpringLdapInjectionSink extends LdapInjectionSink {
129128 ) and
130129 (
131130 // Parameter index is 1 (DN or query) or 2 (filter) if method is not authenticate
132- (
133- index in [ 0 ..1 ] and
134- not m instanceof MethodSpringLdapTemplateAuthenticate
135- ) or
131+ index in [ 0 .. 1 ] and
132+ not m instanceof MethodSpringLdapTemplateAuthenticate
133+ or
136134 // But it's not the last parameter in case of authenticate method (last param is password)
137- (
138- index in [ 0 ..1 ] and
139- index < m .getNumberOfParameters ( ) - 1 and
140- m instanceof MethodSpringLdapTemplateAuthenticate
141- )
135+ index in [ 0 .. 1 ] and
136+ index < m .getNumberOfParameters ( ) - 1 and
137+ m instanceof MethodSpringLdapTemplateAuthenticate
142138 )
143139 )
144140 }
@@ -442,4 +438,4 @@ predicate apacheLdapDnGetStep(ExprNode n1, ExprNode n2) {
442438 m .getDeclaringType ( ) .getAnAncestor ( ) instanceof TypeApacheDn and
443439 ( m .hasName ( "getName" ) or m .hasName ( "getNormName" ) or m .hasName ( "toString" ) )
444440 )
445- }
441+ }
0 commit comments