move the sanitizer-guard to the Query.qll file

This commit is contained in:
Erik Krogh Kristensen
2022-04-13 09:58:33 +02:00
parent 96e4633dfe
commit b13e7c055b
2 changed files with 15 additions and 16 deletions

View File

@@ -27,22 +27,6 @@ module ResourceExhaustion {
*/
abstract class Sanitizer extends DataFlow::Node { }
/**
* A sanitizer that blocks taint flow if the size of a number is limited.
*/
class UpperBoundsCheckSanitizerGuard extends TaintTracking::SanitizerGuardNode,
DataFlow::ValueNode {
override RelationalComparison astNode;
override predicate sanitizes(boolean outcome, Expr e) {
true = outcome and
e = astNode.getLesserOperand()
or
false = outcome and
e = astNode.getGreaterOperand()
}
}
/** A source of remote user input, considered as a data flow source for resource exhaustion vulnerabilities. */
class RemoteFlowSourceAsSource extends Source {
RemoteFlowSourceAsSource() { this instanceof RemoteFlowSource }

View File

@@ -48,3 +48,18 @@ predicate isNumericFlowStep(DataFlow::Node src, DataFlow::Node dst) {
c = DataFlow::globalVarRef(["Number", "parseInt", "parseFloat"]).getACall()
)
}
/**
* A sanitizer that blocks taint flow if the size of a number is limited.
*/
class UpperBoundsCheckSanitizerGuard extends TaintTracking::SanitizerGuardNode, DataFlow::ValueNode {
override RelationalComparison astNode;
override predicate sanitizes(boolean outcome, Expr e) {
true = outcome and
e = astNode.getLesserOperand()
or
false = outcome and
e = astNode.getGreaterOperand()
}
}