Skip to content

Commit cadfd0d

Browse files
committed
Java: convert RsaWithoutOaep test to .qlref
1 parent b7e47e2 commit cadfd0d

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#select
2+
| RsaWithoutOaepTest.java:5:44:5:62 | "RSA/ECB/NoPadding" | RsaWithoutOaepTest.java:5:44:5:62 | "RSA/ECB/NoPadding" | RsaWithoutOaepTest.java:5:44:5:62 | "RSA/ECB/NoPadding" | This specification is used to $@ without OAEP padding. | RsaWithoutOaepTest.java:5:44:5:62 | "RSA/ECB/NoPadding" | initialize an RSA cipher |
3+
| RsaWithoutOaepTest.java:15:32:15:50 | "RSA/ECB/NoPadding" : String | RsaWithoutOaepTest.java:15:32:15:50 | "RSA/ECB/NoPadding" : String | RsaWithoutOaepTest.java:11:35:11:38 | spec | This specification is used to $@ without OAEP padding. | RsaWithoutOaepTest.java:11:35:11:38 | spec | initialize an RSA cipher |
4+
edges
5+
| RsaWithoutOaepTest.java:10:29:10:39 | spec : String | RsaWithoutOaepTest.java:11:35:11:38 | spec | provenance | |
6+
| RsaWithoutOaepTest.java:15:32:15:50 | "RSA/ECB/NoPadding" : String | RsaWithoutOaepTest.java:10:29:10:39 | spec : String | provenance | |
7+
nodes
8+
| RsaWithoutOaepTest.java:5:44:5:62 | "RSA/ECB/NoPadding" | semmle.label | "RSA/ECB/NoPadding" |
9+
| RsaWithoutOaepTest.java:10:29:10:39 | spec : String | semmle.label | spec : String |
10+
| RsaWithoutOaepTest.java:11:35:11:38 | spec | semmle.label | spec |
11+
| RsaWithoutOaepTest.java:15:32:15:50 | "RSA/ECB/NoPadding" : String | semmle.label | "RSA/ECB/NoPadding" : String |
12+
subpaths

java/ql/test/query-tests/security/CWE-780/RsaWithoutOaepTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
class RsaWithoutOaep {
44
public void test() throws Exception {
5-
Cipher rsaBad = Cipher.getInstance("RSA/ECB/NoPadding"); // $hasTaintFlow
5+
Cipher rsaBad = Cipher.getInstance("RSA/ECB/NoPadding"); // $ Alert
66

7-
Cipher rsaGood = Cipher.getInstance("RSA/ECB/OAEPWithSHA-1AndMGF1Padding");
7+
Cipher rsaGood = Cipher.getInstance("RSA/ECB/OAEPWithSHA-1AndMGF1Padding");
88
}
99

1010
public Cipher getCipher(String spec) throws Exception {
11-
return Cipher.getInstance(spec); // $hasTaintFlow
11+
return Cipher.getInstance(spec); // $ Sink
1212
}
1313

1414
public void test2() throws Exception {
15-
Cipher rsa = getCipher("RSA/ECB/NoPadding");
15+
Cipher rsa = getCipher("RSA/ECB/NoPadding"); // $ Alert
1616
}
17-
}
17+
}

java/ql/test/query-tests/security/CWE-780/RsaWithoutOaepTest.ql

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
query: Security/CWE/CWE-780/RsaWithoutOaep.ql
2+
postprocess:
3+
- utils/test/PrettyPrintModels.ql
4+
- utils/test/InlineExpectationsTestQuery.ql

0 commit comments

Comments
 (0)