File tree Expand file tree Collapse file tree 4 files changed +30
-0
lines changed
semmle/code/java/dataflow/internal
test/library-tests/dataflow/collections Expand file tree Collapse file tree 4 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ category : minorAnalysis
3+ ---
4+ * Added a data-flow model for the ` setProperty ` method of ` java.util.Properties ` . Additional results may be found where relevant data is stored in and then retrieved from a ` Properties ` instance.
Original file line number Diff line number Diff line change @@ -244,6 +244,9 @@ private class ContainerFlowSummaries extends SummaryModelCsv {
244244 "java.util;Properties;true;getProperty;(String);;Argument[-1].MapValue;ReturnValue;value;manual" ,
245245 "java.util;Properties;true;getProperty;(String,String);;Argument[-1].MapValue;ReturnValue;value;manual" ,
246246 "java.util;Properties;true;getProperty;(String,String);;Argument[1];ReturnValue;value;manual" ,
247+ "java.util;Properties;true;setProperty;(String,String);;Argument[-1].MapValue;ReturnValue;value;manual" ,
248+ "java.util;Properties;true;setProperty;(String,String);;Argument[0];Argument[-1].MapKey;value;manual" ,
249+ "java.util;Properties;true;setProperty;(String,String);;Argument[1];Argument[-1].MapValue;value;manual" ,
247250 "java.util;Scanner;true;Scanner;;;Argument[0];Argument[-1];taint;manual" ,
248251 "java.util;Scanner;true;findInLine;;;Argument[-1];ReturnValue;taint;manual" ,
249252 "java.util;Scanner;true;findWithinHorizon;;;Argument[-1];ReturnValue;taint;manual" ,
Original file line number Diff line number Diff line change @@ -88,4 +88,23 @@ public void run4() {
8888 Properties clean = new Properties ();
8989 sink (clean .getProperty ("key" , tainted )); // Flow
9090 }
91+
92+ public void run5 () {
93+ Properties p = new Properties ();
94+ p .setProperty ("key" , tainted );
95+ sink (p .getProperty ("key" )); // Flow
96+ sink (p .getProperty ("key" , "defaultValue" )); // Flow
97+ }
98+
99+ public void run6 () {
100+ Properties p = new Properties ();
101+ sink (p .put ("key" , tainted )); // No flow
102+ sink (p .put ("key" , "notTainted" )); // Flow
103+ }
104+
105+ public void run7 () {
106+ Properties p = new Properties ();
107+ sink (p .setProperty ("key" , tainted )); // No flow
108+ sink (p .setProperty ("key" , "notTainted" )); // Flow
109+ }
91110}
Original file line number Diff line number Diff line change 1414| Test.java:84:18:84:24 | tainted | Test.java:85:10:85:29 | getProperty(...) |
1515| Test.java:84:18:84:24 | tainted | Test.java:86:10:86:45 | getProperty(...) |
1616| Test.java:89:35:89:41 | tainted | Test.java:89:10:89:42 | getProperty(...) |
17+ | Test.java:94:26:94:32 | tainted | Test.java:95:10:95:29 | getProperty(...) |
18+ | Test.java:94:26:94:32 | tainted | Test.java:96:10:96:45 | getProperty(...) |
19+ | Test.java:101:23:101:29 | tainted | Test.java:102:10:102:35 | put(...) |
20+ | Test.java:107:31:107:37 | tainted | Test.java:108:10:108:43 | setProperty(...) |
You can’t perform that action at this time.
0 commit comments