Skip to content

Commit 4b3efa8

Browse files
Update TimingAttack.qll
1 parent 005839b commit 4b3efa8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,25 @@ class UserInputInComparisonConfig extends TaintTracking2::Configuration {
292292
}
293293
}
294294

295+
/**
296+
* A configuration tracing flow from a client Secret obtained by an HTTP header to a len() function.
297+
*/
298+
private class ExcludeLenFunc extends TaintTracking2::Configuration {
299+
ExcludeLenFunc() { this = "ExcludeLenFunc" }
300+
301+
override predicate isSource(DataFlow::Node source) { source instanceof ClientSuppliedSecret }
302+
303+
override predicate isSink(DataFlow::Node sink) {
304+
exists(Call call |
305+
call.getFunc().(Name).getId() = "len" and
306+
sink.asExpr() = call.getArg(0)
307+
)
308+
}
309+
}
310+
311+
/**
312+
* Holds if there is a fast-fail check.
313+
*/
295314
private class CompareSink extends DataFlow::Node {
296315
CompareSink() {
297316
exists(Compare compare |
@@ -321,4 +340,13 @@ private class CompareSink extends DataFlow::Node {
321340
)
322341
)
323342
}
343+
344+
/**
345+
* Holds if there is a flow to len().
346+
*/
347+
predicate FlowToLen() {
348+
exists(ExcludeLenFunc config, DataFlow2::PathNode source, DataFlow2::PathNode sink |
349+
config.hasFlowPath(source, sink)
350+
)
351+
}
324352
}

0 commit comments

Comments
 (0)