mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Crypto: Updating weak hash tests
This commit is contained in:
@@ -1,9 +1,4 @@
|
||||
#select
|
||||
| WeakHashing.java:15:55:15:83 | HashAlgorithm | Use of unapproved hash algorithm or API: MD5. |
|
||||
| WeakHashing.java:18:56:18:95 | HashAlgorithm | Use of unapproved hash algorithm or API: MD5. |
|
||||
| WeakHashing.java:21:86:21:90 | HashAlgorithm | Use of unapproved hash algorithm or API: MD5. |
|
||||
| WeakHashing.java:24:56:24:62 | HashAlgorithm | Use of unapproved hash algorithm or API: SHA1. |
|
||||
| WeakHashing.java:34:56:34:96 | HashAlgorithm | Use of unapproved hash algorithm or API: MD5. |
|
||||
testFailures
|
||||
| WeakHashing.java:27:125:27:133 | // $Alert | Missing result: Alert |
|
||||
| WeakHashing.java:40:111:40:119 | // $Alert | Missing result: Alert |
|
||||
|
||||
@@ -30,8 +30,9 @@ public class WeakHashing {
|
||||
|
||||
props2.load(new FileInputStream("unobserved-file.properties"));
|
||||
|
||||
// BAD: "hashalg1" is not visible in the file loaded for props2
|
||||
MessageDigest bad6 = MessageDigest.getInstance(props2.getProperty("hashAlg1", "SHA-256")); // $Alert[java/quantum/weak-hash]
|
||||
// BAD: "hashAlg2" is not visible in the file loaded for props2, should be an unknown
|
||||
// FALSE NEGATIVE for unknown hash
|
||||
MessageDigest bad6 = MessageDigest.getInstance(props2.getProperty("hashAlg2", "SHA-256")); // $Alert[java/quantum/unknown-hash]
|
||||
|
||||
// GOOD: Using a strong hashing algorithm
|
||||
MessageDigest ok = MessageDigest.getInstance(props.getProperty("hashAlg2"));
|
||||
|
||||
Reference in New Issue
Block a user