Skip to content

Commit 71735c8

Browse files
committed
Make WeakCryptoAlgorithm use new API
1 parent 46185e3 commit 71735c8

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

go/ql/src/experimental/CWE-327/WeakCryptoAlgorithm.ql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
*/
1212

1313
import go
14-
import WeakCryptoAlgorithmCustomizations::WeakCryptoAlgorithm
15-
import DataFlow::PathGraph
14+
import WeakCryptoAlgorithmCustomizations
15+
import WeakCryptoAlgorithm::Flow::PathGraph
1616

17-
from Configuration cfg, DataFlow::PathNode source, DataFlow::PathNode sink
18-
where cfg.hasFlowPath(source, sink)
17+
from WeakCryptoAlgorithm::Flow::PathNode source, WeakCryptoAlgorithm::Flow::PathNode sink
18+
where WeakCryptoAlgorithm::Flow::flowPath(source, sink)
1919
select sink.getNode(), source, sink, "$@ is used in a weak cryptographic algorithm.",
2020
source.getNode(), "Sensitive data"

go/ql/src/experimental/CWE-327/WeakCryptoAlgorithmCustomizations.qll

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ module WeakCryptoAlgorithm {
4949
}
5050

5151
/**
52+
* DEPRECATED: Use `Flow` instead.
53+
*
5254
* A configuration depicting taint flow from sensitive information to weak cryptographic algorithms.
5355
*/
54-
class Configuration extends TaintTracking::Configuration {
56+
deprecated class Configuration extends TaintTracking::Configuration {
5557
Configuration() { this = "WeakCryptoAlgorithm" }
5658

5759
override predicate isSource(DataFlow::Node source) { source instanceof Source }
@@ -63,4 +65,14 @@ module WeakCryptoAlgorithm {
6365
node instanceof Sanitizer
6466
}
6567
}
68+
69+
private module Config implements DataFlow::ConfigSig {
70+
predicate isSource(DataFlow::Node source) { source instanceof Source }
71+
72+
predicate isSink(DataFlow::Node sink) { sink instanceof Sink }
73+
74+
predicate isBarrier(DataFlow::Node node) { node instanceof Sanitizer }
75+
}
76+
77+
module Flow = TaintTracking::Global<Config>;
6678
}

0 commit comments

Comments
 (0)