Skip to content

Commit b13e7c0

Browse files
committed
move the sanitizer-guard to the Query.qll file
1 parent 96e4633 commit b13e7c0

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

javascript/ql/lib/semmle/javascript/security/dataflow/ResourceExhaustionCustomizations.qll

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,6 @@ module ResourceExhaustion {
2727
*/
2828
abstract class Sanitizer extends DataFlow::Node { }
2929

30-
/**
31-
* A sanitizer that blocks taint flow if the size of a number is limited.
32-
*/
33-
class UpperBoundsCheckSanitizerGuard extends TaintTracking::SanitizerGuardNode,
34-
DataFlow::ValueNode {
35-
override RelationalComparison astNode;
36-
37-
override predicate sanitizes(boolean outcome, Expr e) {
38-
true = outcome and
39-
e = astNode.getLesserOperand()
40-
or
41-
false = outcome and
42-
e = astNode.getGreaterOperand()
43-
}
44-
}
45-
4630
/** A source of remote user input, considered as a data flow source for resource exhaustion vulnerabilities. */
4731
class RemoteFlowSourceAsSource extends Source {
4832
RemoteFlowSourceAsSource() { this instanceof RemoteFlowSource }

javascript/ql/lib/semmle/javascript/security/dataflow/ResourceExhaustionQuery.qll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,18 @@ predicate isNumericFlowStep(DataFlow::Node src, DataFlow::Node dst) {
4848
c = DataFlow::globalVarRef(["Number", "parseInt", "parseFloat"]).getACall()
4949
)
5050
}
51+
52+
/**
53+
* A sanitizer that blocks taint flow if the size of a number is limited.
54+
*/
55+
class UpperBoundsCheckSanitizerGuard extends TaintTracking::SanitizerGuardNode, DataFlow::ValueNode {
56+
override RelationalComparison astNode;
57+
58+
override predicate sanitizes(boolean outcome, Expr e) {
59+
true = outcome and
60+
e = astNode.getLesserOperand()
61+
or
62+
false = outcome and
63+
e = astNode.getGreaterOperand()
64+
}
65+
}

0 commit comments

Comments
 (0)