mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
Python: Highlight shortcomings of hashlib.new modeling
This commit is contained in:
@@ -27,3 +27,12 @@ hasher = hashlib.new('md5')
|
||||
hasher.update(b"secret") # $ CryptographicOperation CryptographicOperationInput=b"secret" CryptographicOperationAlgorithm=MD5
|
||||
hasher.update(b" message") # $ CryptographicOperation CryptographicOperationInput=b" message" CryptographicOperationAlgorithm=MD5
|
||||
print(hasher.hexdigest())
|
||||
|
||||
|
||||
def foo(arg):
|
||||
hasher = hashlib.new(arg)
|
||||
hasher.update(b"secret") # $ MISSING: CryptographicOperation CryptographicOperationInput=b"secret" CryptographicOperationAlgorithm=MD5
|
||||
hasher.update(b" message") # $ MISSING: CryptographicOperation CryptographicOperationInput=b" message" CryptographicOperationAlgorithm=MD5
|
||||
print(hasher.hexdigest())
|
||||
|
||||
foo("md5")
|
||||
|
||||
Reference in New Issue
Block a user