Skip to content

Commit a658334

Browse files
committed
Python: Add weak crypto key example through function call
We used to handle this, but no more :( Adding this example was inspired by looking at results differences
1 parent 37f0d5a commit a658334

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

python/ql/test/query-tests/Security/CWE-326/weak_crypto.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,16 @@
7575

7676
DSA.generate(DSA_WEAK)
7777
RSA.generate(RSA_WEAK)
78+
79+
# ------------------------------------------------------------------------------
80+
81+
# Through function calls
82+
83+
def make_new_rsa_key_weak(bits):
84+
return RSA.generate(bits) # NOT OK
85+
make_new_rsa_key_weak(RSA_WEAK)
86+
87+
88+
def make_new_rsa_key_strong(bits):
89+
return RSA.generate(bits) # OK
90+
make_new_rsa_key_strong(RSA_STRONG)

0 commit comments

Comments
 (0)