Skip to content

Commit 12bb055

Browse files
committed
Python: Make py/weak-cryptographic-algorithm a path-problem
and stop using deprecated hasFlow
1 parent c5091f1 commit 12bb055

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

python/ql/src/Security/CWE-327/BrokenCryptoAlgorithm.ql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
/**
22
* @name Use of a broken or weak cryptographic algorithm
33
* @description Using broken or weak cryptographic algorithms can compromise security.
4-
* @kind problem
4+
* @kind path-problem
55
* @problem.severity warning
66
* @precision high
77
* @id py/weak-cryptographic-algorithm
88
* @tags security
99
* external/cwe/cwe-327
1010
*/
1111
import python
12+
import semmle.python.security.Paths
1213
import semmle.python.security.SensitiveData
1314
import semmle.python.security.Crypto
1415

@@ -25,7 +26,6 @@ class BrokenCryptoConfiguration extends TaintTracking::Configuration {
2526
}
2627

2728

28-
from BrokenCryptoConfiguration config, SensitiveDataSource src, WeakCryptoSink sink
29-
where config.hasFlow(src, sink)
30-
31-
select sink, "Sensitive data from $@ is used in a broken or weak cryptographic algorithm.", src , src.toString()
29+
from BrokenCryptoConfiguration config, TaintedPathSource src, TaintedPathSink sink
30+
where config.hasFlowPath(src, sink)
31+
select sink.getSink(), src, sink, "$@ is used in a broken or weak cryptographic algorithm.", src.getSource(), "Sensitive data"
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
| test_cryptography.py:8:29:8:37 | Use of weak crypto algorithm | Sensitive data from $@ is used in a broken or weak cryptographic algorithm. | test_cryptography.py:5:17:5:30 | Taint source | Taint source |
2-
| test_pycrypto.py:7:27:7:35 | Use of weak crypto algorithm ARC4 | Sensitive data from $@ is used in a broken or weak cryptographic algorithm. | test_pycrypto.py:5:17:5:30 | Taint source | Taint source |
1+
edges
2+
| test_cryptography.py:5:17:5:30 | a password | test_cryptography.py:8:29:8:37 | a password |
3+
| test_cryptography.py:5:17:5:30 | a password | test_cryptography.py:8:29:8:37 | a password |
4+
| test_pycrypto.py:5:17:5:30 | a password | test_pycrypto.py:7:27:7:35 | a password |
5+
| test_pycrypto.py:5:17:5:30 | a password | test_pycrypto.py:7:27:7:35 | a password |
6+
#select
7+
| test_cryptography.py:8:29:8:37 | dangerous | test_cryptography.py:5:17:5:30 | a password | test_cryptography.py:8:29:8:37 | a password | $@ is used in a broken or weak cryptographic algorithm. | test_cryptography.py:5:17:5:30 | get_password() | Sensitive data |
8+
| test_pycrypto.py:7:27:7:35 | dangerous | test_pycrypto.py:5:17:5:30 | a password | test_pycrypto.py:7:27:7:35 | a password | $@ is used in a broken or weak cryptographic algorithm. | test_pycrypto.py:5:17:5:30 | get_password() | Sensitive data |

0 commit comments

Comments
 (0)