1111
1212import java
1313import ThreadResourceAbuse
14+ import semmle.code.java.dataflow.TaintTracking
1415import semmle.code.java.dataflow.FlowSources
15- import DataFlow :: PathGraph
16+ import ThreadResourceAbuseFlow :: PathGraph
1617
1718/** The `getInitParameter` method of servlet or JSF. */
1819class GetInitParameter extends Method {
@@ -41,18 +42,16 @@ class InitParameterInput extends LocalUserInput {
4142}
4243
4344/** Taint configuration of uncontrolled thread resource consumption from local user input. */
44- class ThreadResourceAbuse extends TaintTracking :: Configuration {
45- ThreadResourceAbuse ( ) { this = "ThreadResourceAbuse" }
45+ module ThreadResourceAbuseConfig implements DataFlow :: ConfigSig {
46+ predicate isSource ( DataFlow :: Node source ) { source instanceof LocalUserInput }
4647
47- override predicate isSource ( DataFlow:: Node source ) { source instanceof LocalUserInput }
48+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof PauseThreadSink }
4849
49- override predicate isSink ( DataFlow:: Node sink ) { sink instanceof PauseThreadSink }
50-
51- override predicate isAdditionalTaintStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
50+ predicate isAdditionalFlowStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
5251 any ( AdditionalValueStep r ) .step ( pred , succ )
5352 }
5453
55- override predicate isSanitizer ( DataFlow:: Node node ) {
54+ predicate isBarrier ( DataFlow:: Node node ) {
5655 exists (
5756 MethodAccess ma // Math.min(sleepTime, MAX_INTERVAL)
5857 |
@@ -64,7 +63,9 @@ class ThreadResourceAbuse extends TaintTracking::Configuration {
6463 }
6564}
6665
67- from DataFlow:: PathNode source , DataFlow:: PathNode sink , ThreadResourceAbuse conf
68- where conf .hasFlowPath ( source , sink )
66+ module ThreadResourceAbuseFlow = TaintTracking:: Global< ThreadResourceAbuseConfig > ;
67+
68+ from ThreadResourceAbuseFlow:: PathNode source , ThreadResourceAbuseFlow:: PathNode sink
69+ where ThreadResourceAbuseFlow:: flowPath ( source , sink )
6970select sink .getNode ( ) , source , sink , "Possible uncontrolled resource consumption due to $@." ,
7071 source .getNode ( ) , "local user-provided value"
0 commit comments