@@ -18,7 +18,7 @@ import semmle.code.java.dataflow.FlowSources
18
18
import semmle.code.java.dataflow.TaintTracking
19
19
import semmle.code.java.frameworks.Servlets
20
20
import semmle.code.xml.WebXML
21
- import DataFlow :: PathGraph
21
+ import UncaughtServletExceptionFlow :: PathGraph
22
22
23
23
/** Holds if a given exception type is caught. */
24
24
private predicate exceptionIsCaught ( TryStmt t , RefType exType ) {
@@ -66,15 +66,15 @@ class UncaughtServletExceptionSink extends DataFlow::ExprNode {
66
66
}
67
67
68
68
/** Taint configuration of uncaught exceptions caused by user provided data from `RemoteFlowSource` */
69
- class UncaughtServletExceptionConfiguration extends TaintTracking :: Configuration {
70
- UncaughtServletExceptionConfiguration ( ) { this = "UncaughtServletException" }
69
+ module UncaughtServletExceptionConfig implements DataFlow :: ConfigSig {
70
+ predicate isSource ( DataFlow :: Node source ) { source instanceof RemoteFlowSource }
71
71
72
- override predicate isSource ( DataFlow:: Node source ) { source instanceof RemoteFlowSource }
73
-
74
- override predicate isSink ( DataFlow:: Node sink ) { sink instanceof UncaughtServletExceptionSink }
72
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof UncaughtServletExceptionSink }
75
73
}
76
74
77
- from DataFlow:: PathNode source , DataFlow:: PathNode sink , UncaughtServletExceptionConfiguration c
78
- where c .hasFlowPath ( source , sink ) and not hasErrorPage ( )
75
+ module UncaughtServletExceptionFlow = TaintTracking:: Global< UncaughtServletExceptionConfig > ;
76
+
77
+ from UncaughtServletExceptionFlow:: PathNode source , UncaughtServletExceptionFlow:: PathNode sink
78
+ where UncaughtServletExceptionFlow:: flowPath ( source , sink ) and not hasErrorPage ( )
79
79
select sink .getNode ( ) , source , sink , "This value depends on a $@ and can throw uncaught exception." ,
80
80
source .getNode ( ) , "user-provided value"
0 commit comments