1313
1414import go
1515
16- class BuiltInMake extends DataFlow:: Node {
17- BuiltInMake ( ) { this = Builtin:: make ( ) .getACall ( ) .getArgument ( 0 ) }
18- }
1916
2017/**
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 .
2219 */
2320predicate denialOfServiceSanitizerGuard ( DataFlow:: Node g , Expr e , boolean branch ) {
2421 exists ( DataFlow:: Node lesser |
2522 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 ( )
3325 )
3426}
3527
28+ /*
29+ * Module for defining predicates and tracking taint flow related to denial of service issues.
30+ */
3631module Config implements DataFlow:: ConfigSig {
3732 predicate isSource ( DataFlow:: Node source ) { source instanceof UntrustedFlowSource }
3833
@@ -48,7 +43,7 @@ module Config implements DataFlow::ConfigSig {
4843 node = DataFlow:: BarrierGuard< denialOfServiceSanitizerGuard / 3 > :: getABarrierNode ( )
4944 }
5045
51- predicate isSink ( DataFlow:: Node sink ) { sink instanceof BuiltInMake }
46+ predicate isSink ( DataFlow:: Node sink ) { sink = Builtin :: make ( ) . getACall ( ) . getArgument ( 0 ) }
5247}
5348
5449/**
0 commit comments