@@ -18,7 +18,7 @@ import semmle.code.java.dataflow.FlowSources
1818import semmle.code.java.dataflow.TaintTracking
1919import semmle.code.java.frameworks.Servlets
2020import semmle.code.xml.WebXML
21- import DataFlow :: PathGraph
21+ import UncaughtServletExceptionFlow :: PathGraph
2222
2323/** Holds if a given exception type is caught. */
2424private predicate exceptionIsCaught ( TryStmt t , RefType exType ) {
@@ -66,15 +66,15 @@ class UncaughtServletExceptionSink extends DataFlow::ExprNode {
6666}
6767
6868/** 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 }
7171
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 }
7573}
7674
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 ( )
7979select sink .getNode ( ) , source , sink , "This value depends on a $@ and can throw uncaught exception." ,
8080 source .getNode ( ) , "user-provided value"
0 commit comments