mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
Add MethodAccessSystemGetProperty predicate
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
| jdk/SystemGetPropertyCall.java:7:9:7:38 | getProperty(...) |
|
||||
| jdk/SystemGetPropertyCall.java:11:9:11:46 | getProperty(...) |
|
||||
| jdk/SystemGetPropertyCall.java:15:9:15:45 | getProperty(...) |
|
||||
10
java/ql/test/library-tests/JDK/SystemGetPropertyCall.ql
Normal file
10
java/ql/test/library-tests/JDK/SystemGetPropertyCall.ql
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @name SystemCall
|
||||
* @description Test the definition of System Get Property
|
||||
*/
|
||||
|
||||
import default
|
||||
|
||||
from MethodAccessSystemGetProperty ma
|
||||
where ma.hasCompileTimeConstantGetPropertyName("user.dir")
|
||||
select ma
|
||||
@@ -0,0 +1,21 @@
|
||||
package jdk;
|
||||
|
||||
public class SystemGetPropertyCall {
|
||||
private static final String USER_DIR_PROPERTY = "user.dir";
|
||||
|
||||
void a() {
|
||||
System.getProperty("user.dir");
|
||||
}
|
||||
|
||||
void b() {
|
||||
System.getProperty("user.dir", "HOME");
|
||||
}
|
||||
|
||||
void c() {
|
||||
System.getProperty(USER_DIR_PROPERTY);
|
||||
}
|
||||
|
||||
void d() {
|
||||
System.getProperty("random.property");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user