@@ -15,20 +15,26 @@ import python
15
15
import semmle.python.dataflow.new.DataFlow
16
16
import semmle.python.dataflow.new.TaintTracking
17
17
import experimental.semmle.python.security.TimingAttack
18
- import DataFlow:: PathGraph
19
18
20
19
/**
21
20
* A configuration tracing flow from a client Secret obtained by an HTTP header to a unsafe Comparison.
22
21
*/
23
- class ClientSuppliedSecretConfig extends TaintTracking :: Configuration {
24
- ClientSuppliedSecretConfig ( ) { this = "ClientSuppliedSecretConfig" }
22
+ private module TimingAttackAgainstHeaderValueConfig implements DataFlow :: ConfigSig {
23
+ predicate isSource ( DataFlow :: Node source ) { source instanceof ClientSuppliedSecret }
25
24
26
- override predicate isSource ( DataFlow:: Node source ) { source instanceof ClientSuppliedSecret }
27
-
28
- override predicate isSink ( DataFlow:: Node sink ) { sink instanceof CompareSink }
25
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof CompareSink }
29
26
}
30
27
31
- from ClientSuppliedSecretConfig config , DataFlow:: PathNode source , DataFlow:: PathNode sink
32
- where config .hasFlowPath ( source , sink ) and not sink .getNode ( ) .( CompareSink ) .flowtolen ( )
28
+ module TimingAttackAgainstHeaderValueFlow =
29
+ TaintTracking:: Global< TimingAttackAgainstHeaderValueConfig > ;
30
+
31
+ import TimingAttackAgainstHeaderValueFlow:: PathGraph
32
+
33
+ from
34
+ TimingAttackAgainstHeaderValueFlow:: PathNode source ,
35
+ TimingAttackAgainstHeaderValueFlow:: PathNode sink
36
+ where
37
+ TimingAttackAgainstHeaderValueFlow:: flowPath ( source , sink ) and
38
+ not sink .getNode ( ) .( CompareSink ) .flowtolen ( )
33
39
select sink .getNode ( ) , source , sink , "Timing attack against $@ validation." , source .getNode ( ) ,
34
40
"client-supplied token"
0 commit comments