Skip to content

Commit c395779

Browse files
authored
Merge pull request github#12643 from chmodxxx/sbaddou/jndisanitizer
Java : Add JndiInjection Sanitizer Class
2 parents 9d88f01 + 3eed4b4 commit c395779

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* Added the extensible abstract class `JndiInjectionSanitizer`. Now this class can be extended to add more sanitizers to the `java/jndi-injection` query.

java/ql/lib/semmle/code/java/security/JndiInjection.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ private import semmle.code.java.frameworks.SpringLdap
99
/** A data flow sink for unvalidated user input that is used in JNDI lookup. */
1010
abstract class JndiInjectionSink extends DataFlow::Node { }
1111

12+
/** A sanitizer for JNDI injection vulnerabilities. */
13+
abstract class JndiInjectionSanitizer extends DataFlow::Node { }
14+
1215
/**
1316
* A unit class for adding additional taint steps.
1417
*

java/ql/lib/semmle/code/java/security/JndiInjectionQuery.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ class JndiInjectionFlowConfig extends TaintTracking::Configuration {
1717
override predicate isSink(DataFlow::Node sink) { sink instanceof JndiInjectionSink }
1818

1919
override predicate isSanitizer(DataFlow::Node node) {
20-
node.getType() instanceof PrimitiveType or node.getType() instanceof BoxedType
20+
node.getType() instanceof PrimitiveType or
21+
node.getType() instanceof BoxedType or
22+
node instanceof JndiInjectionSanitizer
2123
}
2224

2325
override predicate isAdditionalTaintStep(DataFlow::Node node1, DataFlow::Node node2) {

0 commit comments

Comments
 (0)