Skip to content

Commit 6134518

Browse files
committed
[TEST] Java: SensitiveLogInfo: convert to qlref
1 parent 94386f0 commit 6134518

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#select
2+
| Test.java:7:21:7:53 | ... + ... | Test.java:7:46:7:53 | password : String | Test.java:7:21:7:53 | ... + ... | This $@ is written to a log file. | Test.java:7:46:7:53 | password | potentially sensitive information |
3+
| Test.java:8:22:8:52 | ... + ... | Test.java:8:44:8:52 | authToken : String | Test.java:8:22:8:52 | ... + ... | This $@ is written to a log file. | Test.java:8:44:8:52 | authToken | potentially sensitive information |
4+
edges
5+
| Test.java:7:46:7:53 | password : String | Test.java:7:21:7:53 | ... + ... | provenance | Sink:MaD:2 |
6+
| Test.java:8:44:8:52 | authToken : String | Test.java:8:22:8:52 | ... + ... | provenance | Sink:MaD:1 |
7+
models
8+
| 1 | Sink: org.apache.logging.log4j; Logger; true; error; (String); ; Argument[0]; log-injection; manual |
9+
| 2 | Sink: org.apache.logging.log4j; Logger; true; info; (String); ; Argument[0]; log-injection; manual |
10+
nodes
11+
| Test.java:7:21:7:53 | ... + ... | semmle.label | ... + ... |
12+
| Test.java:7:46:7:53 | password : String | semmle.label | password : String |
13+
| Test.java:8:22:8:52 | ... + ... | semmle.label | ... + ... |
14+
| Test.java:8:44:8:52 | authToken : String | semmle.label | authToken : String |
15+
subpaths

java/ql/test/query-tests/security/CWE-532/SensitiveLogInfo.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-532/SensitiveInfoLog.ql
2+
postprocess:
3+
- utils/test/PrettyPrintModels.ql
4+
- utils/test/InlineExpectationsTestQuery.ql

java/ql/test/query-tests/security/CWE-532/Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ class Test {
44
void test(String password, String authToken, String username, String nullToken, String stringTokenizer) {
55
Logger logger = null;
66

7-
logger.info("User's password is: " + password); // $ hasTaintFlow
8-
logger.error("Auth failed for: " + authToken); // $ hasTaintFlow
7+
logger.info("User's password is: " + password); // $ Alert
8+
logger.error("Auth failed for: " + authToken); // $ Alert
99
logger.error("Auth failed for: " + username); // Safe
1010
logger.error("Auth failed for: " + nullToken); // Safe
1111
logger.error("Auth failed for: " + stringTokenizer); // Safe

0 commit comments

Comments
 (0)