Skip to content

Commit 020aa4d

Browse files
Marcono1234smowton
authored andcommitted
Java: Address feedback and fix test failures
1 parent 58d2d5d commit 020aa4d

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

java/ql/lib/semmle/code/java/security/Encryption.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ string getInsecureAlgorithmRegex() {
168168
string getASecureAlgorithmName() {
169169
result =
170170
[
171-
"RSA", "SHA256", "SHA512", "CCM", "GCM", "AES([^a-zA-Z](?!ECB|CBC/PKCS[57]Padding)).*",
171+
"RSA", "SHA256", "SHA512", "CCM", "GCM", "AES(?![^a-zA-Z](ECB|CBC/PKCS[57]Padding))",
172172
"Blowfish", "ECIES"
173173
]
174174
}

java/ql/src/Violations of Best Practice/Magic Constants/MagicConstants.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ predicate literalInsteadOfConstant(
391391
exists(string context |
392392
canUseFieldInsteadOfLiteral(constField, magicLiteral, context) and
393393
message =
394-
"Literal value '" + magicLiteral.getValue() + "' used " + " in a call to " + context +
394+
"Literal value '" + magicLiteral.getLiteral() + "' used " + " in a call to " + context +
395395
"; consider using the defined constant $@." and
396396
linkText = constField.getName() and
397397
(

java/ql/test/query-tests/security/CWE-327/semmle/tests/BrokenCryptoAlgorithm.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ nodes
44
| Test.java:42:33:42:37 | "RC2" | semmle.label | "RC2" |
55
subpaths
66
#select
7-
| 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" |
8-
| 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" |
7+
| 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 |
8+
| 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 |

java/ql/test/query-tests/security/CWE-327/semmle/tests/MaybeBrokenCryptoAlgorithm.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ nodes
33
| Test.java:34:48:34:52 | "foo" | semmle.label | "foo" |
44
subpaths
55
#select
6-
| 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" |
6+
| 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 |

0 commit comments

Comments
 (0)