Java: remove models for System.[get|set]Property · xia0le/codeql@10f0975 · GitHub
Skip to content

Commit 10f0975

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Java: remove models for System.[get|set]Property
1 parent fb6725d commit 10f0975

4 files changed

Lines changed: 3 additions & 8 deletions

File tree

‎java/ql/lib/ext/java.lang.model.yml‎

Lines changed: 0 additions & 4 deletions

‎java/ql/test/ext/TestModels/Test.java‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ public void test() throws Exception {
6464
sink((String)e4.getMessage()); // $hasValueFlow
6565
sink((Throwable)e4.getCause()); // $hasValueFlow
6666

67-
System.setProperty("testKey", (String)source());
68-
sink(System.getProperty("testKey")); // $hasValueFlow
69-
7067
// java.sql
7168
Connection con = DriverManager.getConnection("");
7269
PreparedStatement ps1 = con.prepareStatement("UPDATE EMPLOYEES SET NAME = ? WHERE ID = ?");

‎java/ql/test/ext/TopJdkApis/TopJdkApis.qll‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ class TopJdkApi extends SummarizedCallableBase {
142142
/** Holds if this API has a manual MaD model. */
143143
predicate hasManualMadModel() { this.hasManualSummary() or this.hasManualNeutral() }
144144
/*
145-
* Note: the following top-100 APIs are not modeled with MaD:
145+
* Note: the following top JDK APIs are not modeled with MaD:
146146
* `java.lang.String#valueOf(Object)`: a complex case; an alias for `Object.toString`, except the dispatch is hidden
147+
* `java.lang.System#getProperty(String)`: needs to be modeled by regular CodeQL matching the get and set keys to reduce FPs
147148
* `java.lang.Throwable#printStackTrace()`: should probably not be a general step, but there might be specialised queries that care
148149
* `java.util.function.Consumer#accept(Object)`: specialized lambda flow
149150
* `java.util.function.Function#apply(Object)`: specialized lambda flow

‎java/ql/test/ext/TopJdkApis/TopJdkApisTest.expected‎

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)