13
13
14
14
import go
15
15
16
- class BuiltInMake extends DataFlow:: Node {
17
- BuiltInMake ( ) { this = Builtin:: make ( ) .getACall ( ) .getArgument ( 0 ) }
18
- }
19
16
20
17
/**
21
- * Holds if `g` is a barrier-guard which checks `e` is nonzero on `branch` .
18
+ * Class for defining a predicate to check for denial of service sanitizer guard .
22
19
*/
23
20
predicate denialOfServiceSanitizerGuard ( DataFlow:: Node g , Expr e , boolean branch ) {
24
21
exists ( DataFlow:: Node lesser |
25
22
e = lesser .asExpr ( ) and
26
- g .( DataFlow:: RelationalComparisonNode ) .leq ( branch , lesser , _, _)
27
- )
28
- or
29
- exists ( LogicalBinaryExpr lbe , DataFlow:: Node lesser |
30
- lbe .getAnOperand ( ) = g .( DataFlow:: RelationalComparisonNode ) .asExpr ( ) and
31
- e = lesser .asExpr ( ) and
32
- g .( DataFlow:: RelationalComparisonNode ) .leq ( branch , lesser , _, _)
23
+ g .( DataFlow:: RelationalComparisonNode ) .leq ( branch , lesser , _, _) and
24
+ not e .isConst ( )
33
25
)
34
26
}
35
27
28
+ /*
29
+ * Module for defining predicates and tracking taint flow related to denial of service issues.
30
+ */
36
31
module Config implements DataFlow:: ConfigSig {
37
32
predicate isSource ( DataFlow:: Node source ) { source instanceof UntrustedFlowSource }
38
33
@@ -48,7 +43,7 @@ module Config implements DataFlow::ConfigSig {
48
43
node = DataFlow:: BarrierGuard< denialOfServiceSanitizerGuard / 3 > :: getABarrierNode ( )
49
44
}
50
45
51
- predicate isSink ( DataFlow:: Node sink ) { sink instanceof BuiltInMake }
46
+ predicate isSink ( DataFlow:: Node sink ) { sink = Builtin :: make ( ) . getACall ( ) . getArgument ( 0 ) }
52
47
}
53
48
54
49
/**
0 commit comments