Java: Address feedback and fix test failures

This commit is contained in:
Marcono1234
2021-09-11 02:48:24 +02:00
committed by Chris Smowton
parent 58d2d5d14e
commit 020aa4d94c
4 changed files with 5 additions and 5 deletions

View File

@@ -168,7 +168,7 @@ string getInsecureAlgorithmRegex() {
string getASecureAlgorithmName() {
result =
[
"RSA", "SHA256", "SHA512", "CCM", "GCM", "AES([^a-zA-Z](?!ECB|CBC/PKCS[57]Padding)).*",
"RSA", "SHA256", "SHA512", "CCM", "GCM", "AES(?![^a-zA-Z](ECB|CBC/PKCS[57]Padding))",
"Blowfish", "ECIES"
]
}

View File

@@ -391,7 +391,7 @@ predicate literalInsteadOfConstant(
exists(string context |
canUseFieldInsteadOfLiteral(constField, magicLiteral, context) and
message =
"Literal value '" + magicLiteral.getValue() + "' used " + " in a call to " + context +
"Literal value '" + magicLiteral.getLiteral() + "' used " + " in a call to " + context +
"; consider using the defined constant $@." and
linkText = constField.getName() and
(

View File

@@ -4,5 +4,5 @@ nodes
| Test.java:42:33:42:37 | "RC2" | semmle.label | "RC2" |
subpaths
#select
| Test.java:19:20:19:50 | getInstance(...) | Test.java:19:45:19:49 | "DES" | Test.java:19:45:19:49 | "DES" | Cryptographic algorithm $@ is weak and should not be used. | Test.java:19:45:19:49 | "DES" | "DES" |
| Test.java:42:14:42:38 | getInstance(...) | Test.java:42:33:42:37 | "RC2" | Test.java:42:33:42:37 | "RC2" | Cryptographic algorithm $@ is weak and should not be used. | Test.java:42:33:42:37 | "RC2" | "RC2" |
| Test.java:19:20:19:50 | getInstance(...) | Test.java:19:45:19:49 | "DES" | Test.java:19:45:19:49 | "DES" | Cryptographic algorithm $@ is weak and should not be used. | Test.java:19:45:19:49 | "DES" | DES |
| Test.java:42:14:42:38 | getInstance(...) | Test.java:42:33:42:37 | "RC2" | Test.java:42:33:42:37 | "RC2" | Cryptographic algorithm $@ is weak and should not be used. | Test.java:42:33:42:37 | "RC2" | RC2 |

View File

@@ -3,4 +3,4 @@ nodes
| Test.java:34:48:34:52 | "foo" | semmle.label | "foo" |
subpaths
#select
| Test.java:34:21:34:53 | new SecretKeySpec(...) | Test.java:34:48:34:52 | "foo" | Test.java:34:48:34:52 | "foo" | Cryptographic algorithm $@ may not be secure, consider using a different algorithm. | Test.java:34:48:34:52 | "foo" | "foo" |
| Test.java:34:21:34:53 | new SecretKeySpec(...) | Test.java:34:48:34:52 | "foo" | Test.java:34:48:34:52 | "foo" | Cryptographic algorithm $@ may not be secure, consider using a different algorithm. | Test.java:34:48:34:52 | "foo" | foo |