File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
semmle/code/java/security Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,7 @@ class LdapInjectionFlowConfig extends TaintTracking::Configuration {
13
13
14
14
override predicate isSink ( DataFlow:: Node sink ) { sink instanceof LdapInjectionSink }
15
15
16
- override predicate isSanitizer ( DataFlow:: Node node ) {
17
- node .getType ( ) instanceof PrimitiveType or node .getType ( ) instanceof BoxedType
18
- }
16
+ override predicate isSanitizer ( DataFlow:: Node node ) { node instanceof LdapInjectionSanitizer }
19
17
20
18
override predicate isAdditionalTaintStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
21
19
ldapNameStep ( node1 , node2 ) or
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ import semmle.code.java.frameworks.ApacheLdap
10
10
/** A data flow sink for unvalidated user input that is used to construct LDAP queries. */
11
11
abstract class LdapInjectionSink extends DataFlow:: Node { }
12
12
13
+ /** A class that identifies sanitizers that prevent LDAP injection attacks. */
14
+ abstract class LdapInjectionSanitizer extends DataFlow:: Node { }
15
+
13
16
private predicate jndiLdapInjectionSinkMethod ( Method m , int index ) {
14
17
m .getDeclaringType ( ) .getAnAncestor ( ) instanceof TypeDirContext and
15
18
m .hasName ( "search" ) and
@@ -105,3 +108,13 @@ private class ApacheLdapInjectionSink extends LdapInjectionSink {
105
108
)
106
109
}
107
110
}
111
+
112
+ /** A sanitizer that clears the taint on primitive types. */
113
+ private class PrimitiveTypeLdapSanitizer extends LdapInjectionSanitizer {
114
+ PrimitiveTypeLdapSanitizer ( ) { this .getType ( ) instanceof PrimitiveType }
115
+ }
116
+
117
+ /** A sanitizer that clears the taint on boxed primitive types. */
118
+ private class BoxedTypeLdapSanitizer extends LdapInjectionSanitizer {
119
+ BoxedTypeLdapSanitizer ( ) { this .getType ( ) instanceof BoxedType }
120
+ }
You can’t perform that action at this time.
0 commit comments