Skip to content

Commit 8abd343

Browse files
committed
Python: Move experimental TimingAttackAgainstSensitiveInfo to new dataflow API
1 parent 1a4e8d9 commit 8abd343

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

python/ql/src/experimental/Security/CWE-208/TimingAttackAgainstSensitiveInfo/TimingAttackAgainstSensitiveInfo.ql

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,25 @@ import python
1515
import semmle.python.dataflow.new.DataFlow
1616
import semmle.python.dataflow.new.TaintTracking
1717
import experimental.semmle.python.security.TimingAttack
18-
import DataFlow::PathGraph
18+
import TimingAttackAgainstSensitiveInfoFlow::PathGraph
1919

2020
/**
2121
* A configuration tracing flow from obtaining a client Secret to a unsafe Comparison.
2222
*/
23-
class ClientSuppliedSecretConfig extends TaintTracking::Configuration {
24-
ClientSuppliedSecretConfig() { this = "ClientSuppliedSecretConfig" }
23+
private module TimingAttackAgainstSensitiveInfoConfig implements DataFlow::ConfigSig {
24+
predicate isSource(DataFlow::Node source) { source instanceof SecretSource }
2525

26-
override predicate isSource(DataFlow::Node source) { source instanceof SecretSource }
27-
28-
override predicate isSink(DataFlow::Node sink) { sink instanceof NonConstantTimeComparisonSink }
26+
predicate isSink(DataFlow::Node sink) { sink instanceof NonConstantTimeComparisonSink }
2927
}
3028

31-
from ClientSuppliedSecretConfig config, DataFlow::PathNode source, DataFlow::PathNode sink
29+
module TimingAttackAgainstSensitiveInfoFlow =
30+
TaintTracking::Global<TimingAttackAgainstSensitiveInfoConfig>;
31+
32+
from
33+
TimingAttackAgainstSensitiveInfoFlow::PathNode source,
34+
TimingAttackAgainstSensitiveInfoFlow::PathNode sink
3235
where
33-
config.hasFlowPath(source, sink) and
36+
TimingAttackAgainstSensitiveInfoFlow::flowPath(source, sink) and
3437
(
3538
source.getNode().(SecretSource).includesUserInput() or
3639
sink.getNode().(NonConstantTimeComparisonSink).includesUserInput()

0 commit comments

Comments
 (0)