Skip to content

Commit 016136a

Browse files
Update TimingAttack.qll
1 parent 64bb022 commit 016136a

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

python/ql/src/experimental/semmle/python/security/TimingAttack.qll

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,34 @@ class UserInputInComparisonConfig extends TaintTracking2::Configuration {
289289
)
290290
}
291291
}
292+
293+
private class CompareSink extends DataFlow::Node {
294+
CompareSink() {
295+
exists(Compare compare |
296+
(
297+
compare.getOp(0) instanceof Eq or
298+
compare.getOp(0) instanceof NotEq or
299+
compare.getOp(0) instanceof In
300+
) and
301+
(
302+
compare.getLeft() = this.asExpr() and
303+
not compare.getComparator(0).(StrConst).getText() = "bearer"
304+
or
305+
compare.getComparator(0) = this.asExpr() and
306+
not compare.getLeft().(StrConst).getText() = "bearer"
307+
)
308+
) or
309+
exists(Compare compare |
310+
(
311+
compare.getOp(0) instanceof IsNot
312+
) and
313+
(
314+
compare.getLeft() = this.asExpr() and
315+
not compare.getComparator(0) instanceof None
316+
or
317+
compare.getComparator(0) = this.asExpr() and
318+
not compare.getLeft() instanceof None
319+
)
320+
)
321+
}
322+
}

0 commit comments

Comments
 (0)