File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
javascript/ql/src/semmle/javascript/dataflow Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -587,14 +587,14 @@ module TaintTracking {
587
587
588
588
}
589
589
590
- /** A check of the form `if(o .indexOf(x) != -1)`, which sanitizes `x` in its "then" branch. */
590
+ /** A check of the form `if(whitelist .indexOf(x) != -1)`, which sanitizes `x` in its "then" branch. */
591
591
class IndexOfSanitizer extends AdditionalSanitizerGuardNode , DataFlow:: ValueNode {
592
592
MethodCallExpr indexOf ;
593
593
override EqualityTest astNode ;
594
594
595
595
IndexOfSanitizer ( ) {
596
596
exists ( Expr index | astNode .hasOperands ( indexOf , index ) |
597
- // one operand is of the form `o .indexOf(x)`
597
+ // one operand is of the form `whitelist .indexOf(x)`
598
598
indexOf .getMethodName ( ) = "indexOf" and
599
599
// and the other one is -1
600
600
index .getIntValue ( ) = - 1
@@ -612,7 +612,11 @@ module TaintTracking {
612
612
613
613
}
614
614
615
- /** A check of the form `if(~o.indexOf(x))`, which sanitizes `x` in its "then" branch. */
615
+ /**
616
+ * A check of the form `if(~whitelist.indexOf(x))`, which sanitizes `x` in its "then" branch.
617
+ *
618
+ * This sanitizer is equivalent to `if(whitelist.indexOf(x) != -1)`, since `~n = 0` iff `n = -1`.
619
+ */
616
620
class BitwiseIndexOfSanitizer extends AdditionalSanitizerGuardNode , DataFlow:: ValueNode {
617
621
MethodCallExpr indexOf ;
618
622
override BitNotExpr astNode ;
You can’t perform that action at this time.
0 commit comments