mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Python: Ignore weak key-sizes from test-code in weak-crypto-key
From looking at old results on LGTM.com, this was quite common (and those alerts doesn't really provide value).
This commit is contained in:
@@ -12,11 +12,13 @@
|
||||
import python
|
||||
import semmle.python.Concepts
|
||||
import semmle.python.dataflow.new.DataFlow
|
||||
import semmle.python.filters.Tests
|
||||
|
||||
from Cryptography::PublicKey::KeyGeneration keyGen, int keySize, DataFlow::Node origin
|
||||
where
|
||||
keySize = keyGen.getKeySizeWithOrigin(origin) and
|
||||
keySize < keyGen.minimumSecureKeySize()
|
||||
keySize < keyGen.minimumSecureKeySize() and
|
||||
not origin.getScope().getScope*() instanceof TestScope
|
||||
select keyGen,
|
||||
"Creation of an " + keyGen.getName() + " key uses $@ bits, which is below " +
|
||||
keyGen.minimumSecureKeySize() + " and considered breakable.", origin, keySize.toString()
|
||||
|
||||
Reference in New Issue
Block a user