mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
Fix tests
This commit is contained in:
@@ -1,15 +1,45 @@
|
||||
package generatedtest;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.Callable;
|
||||
import org.springframework.cache.Cache;
|
||||
|
||||
|
||||
// Test case generated by GenerateFlowTestCase.ql
|
||||
public class Test {
|
||||
|
||||
Object getMapKey(Object container) { return null; }
|
||||
Object getMapValue(Object container) { return null; }
|
||||
Object newWithMapKey(Object element) { return null; }
|
||||
Object newWithMapValue(Object element) { return null; }
|
||||
public class ValueWrapper extends HashMap<Object,Object> implements Cache.ValueWrapper {
|
||||
ValueWrapper(Object element) {
|
||||
super();
|
||||
this.put(null, element);
|
||||
}
|
||||
|
||||
public Object get() { return this.get(null); }
|
||||
}
|
||||
|
||||
public class DummyCache implements Cache {
|
||||
DummyCache(Object key, Object value) {
|
||||
this.put(key, value);
|
||||
}
|
||||
|
||||
public void clear() {}
|
||||
public void evict(Object key) {}
|
||||
public boolean evictIfPresent(Object key) { return false; }
|
||||
public Cache.ValueWrapper get(Object key) { return null; }
|
||||
public <T> T get(Object key, Callable<T> valueLoader) { return null; }
|
||||
public <T> T get(Object key, Class<T> type) { return null; }
|
||||
public String getName() { return null; }
|
||||
public Object getNativeCache() { return null; }
|
||||
//public default boolean invalidate() { return false; }
|
||||
public void put(Object key, Object value) {}
|
||||
//default Cache.ValueWrapper putIfAbsent(Object key, Object value) { return null; }
|
||||
}
|
||||
|
||||
Object getMapKey(Cache.ValueRetrievalException container) { return container.getKey(); }
|
||||
Object getMapKey(Cache container) { return ((Map)container.getNativeCache()).keySet().iterator().next(); }
|
||||
Object getMapValue(Cache container) { return container.get(null, (Class)null); }
|
||||
Object getMapValue(Cache.ValueWrapper container) { return container.get(); }
|
||||
Object source() { return null; }
|
||||
void sink(Object o) { }
|
||||
|
||||
@@ -19,57 +49,57 @@ public class Test {
|
||||
// "org.springframework.cache;Cache$ValueRetrievalException;false;ValueRetrievalException;;;Argument[0];MapKey of Argument[-1];value"
|
||||
Cache.ValueRetrievalException out = null;
|
||||
Object in = source();
|
||||
out = new ValueRetrievalException(in, null, null);
|
||||
out = new Cache.ValueRetrievalException(in, null, null);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.cache;Cache$ValueRetrievalException;false;getKey;;;MapKey of Argument[-1];ReturnValue;value"
|
||||
Object out = null;
|
||||
Cache.ValueRetrievalException in = (Cache.ValueRetrievalException)newWithMapKey(source());
|
||||
Cache.ValueRetrievalException in = new Cache.ValueRetrievalException(source(), null, null);
|
||||
out = in.getKey();
|
||||
sink(out); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.cache;Cache$ValueWrapper;true;get;;;MapValue of Argument[-1];ReturnValue;value"
|
||||
Object out = null;
|
||||
Cache.ValueWrapper in = (Cache.ValueWrapper)newWithMapValue(source());
|
||||
Cache.ValueWrapper in = new ValueWrapper(source());
|
||||
out = in.get();
|
||||
sink(out); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.cache;Cache;true;get;(Object);;MapValue of Argument[-1];MapValue of ReturnValue;value"
|
||||
Cache.ValueWrapper out = null;
|
||||
Cache in = (Cache)newWithMapValue(source());
|
||||
Cache in = new DummyCache(null, source());
|
||||
out = in.get(null);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.cache;Cache;true;get;(Object,Callable);;MapValue of Argument[-1];ReturnValue;value"
|
||||
Object out = null;
|
||||
Cache in = (Cache)newWithMapValue(source());
|
||||
Cache in = new DummyCache(null, source());
|
||||
out = in.get(null, (Callable)null);
|
||||
sink(out); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.cache;Cache;true;get;(Object,Class);;MapValue of Argument[-1];ReturnValue;value"
|
||||
Object out = null;
|
||||
Cache in = (Cache)newWithMapValue(source());
|
||||
Cache in = new DummyCache(null, source());
|
||||
out = in.get(null, (Class)null);
|
||||
sink(out); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.cache;Cache;true;getNativeCache;;;MapKey of Argument[-1];MapKey of ReturnValue;value"
|
||||
Object out = null;
|
||||
Cache in = (Cache)newWithMapKey(source());
|
||||
Cache in = new DummyCache(source(), null);
|
||||
out = in.getNativeCache();
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
sink(getMapKey((Cache)out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.cache;Cache;true;getNativeCache;;;MapValue of Argument[-1];MapValue of ReturnValue;value"
|
||||
Object out = null;
|
||||
Cache in = (Cache)newWithMapValue(source());
|
||||
Cache in = new DummyCache(null, source());
|
||||
out = in.getNativeCache();
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
sink(getMapValue((Cache)out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.cache;Cache;true;put;;;Argument[0];MapKey of Argument[-1];value"
|
||||
@@ -102,11 +132,11 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.cache;Cache;true;putIfAbsent;;;MapValue of Argument[-1];MapValue of ReturnValue;value"
|
||||
Cache.ValueWrapper out = null;
|
||||
Cache in = (Cache)newWithMapValue(source());
|
||||
Cache in = new DummyCache(null, source());
|
||||
out = in.putIfAbsent(null, null);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,8 @@
|
||||
import java
|
||||
import semmle.code.java.dataflow.DataFlow
|
||||
import semmle.code.java.dataflow.ExternalFlow
|
||||
import semmle.code.java.dataflow.TaintTracking
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class SummaryModelTest extends SummaryModelCsv {
|
||||
override predicate row(string row) {
|
||||
row =
|
||||
[
|
||||
//"package;type;overrides;name;signature;ext;inputspec;outputspec;kind",
|
||||
"generatedtest;Test;false;getMapKey;;;MapKey of Argument[0];ReturnValue;value",
|
||||
"generatedtest;Test;false;newWithMapKey;;;Argument[0];MapKey of ReturnValue;value",
|
||||
"generatedtest;Test;false;getMapValue;;;MapValue of Argument[0];ReturnValue;value",
|
||||
"generatedtest;Test;false;newWithMapValue;;;Argument[0];MapValue of ReturnValue;value"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
class ValueFlowConf extends DataFlow::Configuration {
|
||||
ValueFlowConf() { this = "qltest:valueFlowConf" }
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package generatedtest;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import org.springframework.ui.ConcurrentModel;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
@@ -9,11 +10,14 @@ import org.springframework.ui.ModelMap;
|
||||
// Test case generated by GenerateFlowTestCase.ql
|
||||
public class Test {
|
||||
|
||||
Object getMapKey(Object container) { return null; }
|
||||
Object getMapValue(Object container) { return null; }
|
||||
Object newWithElement(Object element) { return null; }
|
||||
Object newWithMapKey(Object element) { return null; }
|
||||
Object newWithMapValue(Object element) { return null; }
|
||||
<K> K getMapKey(Map<K,?> container) { return container.keySet().iterator().next(); }
|
||||
<V> V getMapValue(Map<?,V> container) { return container.get(null); }
|
||||
String getMapKey(Model container) { return container.asMap().keySet().iterator().next(); }
|
||||
Object getMapValue(Model container) { return container.getAttribute(null); }
|
||||
String getMapKey(ConcurrentModel container) { return container.keySet().iterator().next(); }
|
||||
Object getMapValue(ConcurrentModel container) { return container.getAttribute(null); }
|
||||
String getMapKey(ModelMap container) { return container.keySet().iterator().next(); }
|
||||
Object getMapValue(ModelMap container) { return container.getAttribute(null); }
|
||||
Object source() { return null; }
|
||||
void sink(Object o) { }
|
||||
|
||||
@@ -43,21 +47,21 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;Model;true;addAllAttributes;(Collection);;Element of Argument[0];MapValue of Argument[-1];value"
|
||||
Model out = null;
|
||||
Collection in = (Collection)newWithElement(source());
|
||||
Collection in = List.of(source());
|
||||
out.addAllAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;addAllAttributes;(Collection);;Element of Argument[0];MapValue of Argument[-1];value"
|
||||
ConcurrentModel out = null;
|
||||
Collection in = (Collection)newWithElement(source());
|
||||
Collection in = List.of(source());
|
||||
out.addAllAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;addAllAttributes;(Collection);;Element of Argument[0];MapValue of ReturnValue;value"
|
||||
Model out = null;
|
||||
Collection in = (Collection)newWithElement(source());
|
||||
Collection in = List.of(source());
|
||||
Model instance = null;
|
||||
out = instance.addAllAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
@@ -65,7 +69,7 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;Model;true;addAllAttributes;(Collection);;Element of Argument[0];MapValue of ReturnValue;value"
|
||||
ConcurrentModel out = null;
|
||||
Collection in = (Collection)newWithElement(source());
|
||||
Collection in = List.of(source());
|
||||
ConcurrentModel instance = null;
|
||||
out = instance.addAllAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
@@ -73,21 +77,21 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;Model;true;addAllAttributes;(Map);;MapKey of Argument[0];MapKey of Argument[-1];value"
|
||||
Model out = null;
|
||||
Map in = (Map)newWithMapKey(source());
|
||||
Map in = Map.of(source(), null);
|
||||
out.addAllAttributes(in);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;addAllAttributes;(Map);;MapKey of Argument[0];MapKey of Argument[-1];value"
|
||||
ConcurrentModel out = null;
|
||||
Map in = (Map)newWithMapKey(source());
|
||||
Map in = Map.of(source(), null);
|
||||
out.addAllAttributes(in);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;addAllAttributes;(Map);;MapKey of Argument[0];MapKey of ReturnValue;value"
|
||||
Model out = null;
|
||||
Map in = (Map)newWithMapKey(source());
|
||||
Map in = Map.of(source(), null);
|
||||
Model instance = null;
|
||||
out = instance.addAllAttributes(in);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
@@ -95,7 +99,7 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;Model;true;addAllAttributes;(Map);;MapKey of Argument[0];MapKey of ReturnValue;value"
|
||||
ConcurrentModel out = null;
|
||||
Map in = (Map)newWithMapKey(source());
|
||||
Map in = Map.of(source(), null);
|
||||
ConcurrentModel instance = null;
|
||||
out = instance.addAllAttributes(in);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
@@ -103,21 +107,21 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;Model;true;addAllAttributes;(Map);;MapValue of Argument[0];MapValue of Argument[-1];value"
|
||||
Model out = null;
|
||||
Map in = (Map)newWithMapValue(source());
|
||||
Map in = Map.of(null, source());
|
||||
out.addAllAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;addAllAttributes;(Map);;MapValue of Argument[0];MapValue of Argument[-1];value"
|
||||
ConcurrentModel out = null;
|
||||
Map in = (Map)newWithMapValue(source());
|
||||
Map in = Map.of(null, source());
|
||||
out.addAllAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;addAllAttributes;(Map);;MapValue of Argument[0];MapValue of ReturnValue;value"
|
||||
Model out = null;
|
||||
Map in = (Map)newWithMapValue(source());
|
||||
Map in = Map.of(null, source());
|
||||
Model instance = null;
|
||||
out = instance.addAllAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
@@ -125,7 +129,7 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;Model;true;addAllAttributes;(Map);;MapValue of Argument[0];MapValue of ReturnValue;value"
|
||||
ConcurrentModel out = null;
|
||||
Map in = (Map)newWithMapValue(source());
|
||||
Map in = Map.of(null, source());
|
||||
ConcurrentModel instance = null;
|
||||
out = instance.addAllAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
@@ -279,42 +283,42 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;Model;true;asMap;;;MapKey of Argument[-1];MapKey of ReturnValue;value"
|
||||
Map out = null;
|
||||
Model in = (Model)newWithMapKey(source());
|
||||
Model in = new ConcurrentModel((String)source(), null);
|
||||
out = in.asMap();
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;asMap;;;MapKey of Argument[-1];MapKey of ReturnValue;value"
|
||||
Map out = null;
|
||||
ConcurrentModel in = (ConcurrentModel)newWithMapKey(source());
|
||||
ConcurrentModel in = new ConcurrentModel((String)source(), null);
|
||||
out = in.asMap();
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;asMap;;;MapValue of Argument[-1];MapValue of ReturnValue;value"
|
||||
Map out = null;
|
||||
Model in = (Model)newWithMapValue(source());
|
||||
Model in = (Model)Map.of(null, source());
|
||||
out = in.asMap();
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;asMap;;;MapValue of Argument[-1];MapValue of ReturnValue;value"
|
||||
Map out = null;
|
||||
ConcurrentModel in = (ConcurrentModel)newWithMapValue(source());
|
||||
ConcurrentModel in = new ConcurrentModel(null, source());
|
||||
out = in.asMap();
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;getAttribute;;;MapValue of Argument[-1];ReturnValue;value"
|
||||
Object out = null;
|
||||
Model in = (Model)newWithMapValue(source());
|
||||
Model in = (Model)Map.of(null, source());
|
||||
out = in.getAttribute(null);
|
||||
sink(out); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;getAttribute;;;MapValue of Argument[-1];ReturnValue;value"
|
||||
Object out = null;
|
||||
ConcurrentModel in = (ConcurrentModel)newWithMapValue(source());
|
||||
ConcurrentModel in = new ConcurrentModel(null, source());
|
||||
out = in.getAttribute(null);
|
||||
sink(out); // $hasValueFlow
|
||||
}
|
||||
@@ -335,56 +339,56 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;Model;true;mergeAttributes;;;MapKey of Argument[-1];MapKey of ReturnValue;value"
|
||||
Model out = null;
|
||||
Model in = (Model)newWithMapKey(source());
|
||||
Model in = new ConcurrentModel((String)source(), null);
|
||||
out = in.mergeAttributes(null);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;mergeAttributes;;;MapKey of Argument[-1];MapKey of ReturnValue;value"
|
||||
ConcurrentModel out = null;
|
||||
ConcurrentModel in = (ConcurrentModel)newWithMapKey(source());
|
||||
ConcurrentModel in = new ConcurrentModel((String)source(), null);
|
||||
out = in.mergeAttributes(null);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;mergeAttributes;;;MapKey of Argument[0];MapKey of Argument[-1];value"
|
||||
Model out = null;
|
||||
Map in = (Map)newWithMapKey(source());
|
||||
Map in = Map.of(source(), null);
|
||||
out.mergeAttributes(in);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;mergeAttributes;;;MapKey of Argument[0];MapKey of Argument[-1];value"
|
||||
ConcurrentModel out = null;
|
||||
Map in = (Map)newWithMapKey(source());
|
||||
Map in = Map.of(source(), null);
|
||||
out.mergeAttributes(in);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;mergeAttributes;;;MapValue of Argument[-1];MapValue of ReturnValue;value"
|
||||
Model out = null;
|
||||
Model in = (Model)newWithMapValue(source());
|
||||
Model in = (Model)Map.of(null, source());
|
||||
out = in.mergeAttributes(null);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;mergeAttributes;;;MapValue of Argument[-1];MapValue of ReturnValue;value"
|
||||
ConcurrentModel out = null;
|
||||
ConcurrentModel in = (ConcurrentModel)newWithMapValue(source());
|
||||
ConcurrentModel in = new ConcurrentModel(null, source());
|
||||
out = in.mergeAttributes(null);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;mergeAttributes;;;MapValue of Argument[0];MapValue of Argument[-1];value"
|
||||
Model out = null;
|
||||
Map in = (Map)newWithMapValue(source());
|
||||
Map in = Map.of(null, source());
|
||||
out.mergeAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;Model;true;mergeAttributes;;;MapValue of Argument[0];MapValue of Argument[-1];value"
|
||||
ConcurrentModel out = null;
|
||||
Map in = (Map)newWithMapValue(source());
|
||||
Map in = Map.of(null, source());
|
||||
out.mergeAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
@@ -412,14 +416,14 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;ModelMap;false;addAllAttributes;(Collection);;Element of Argument[0];MapValue of Argument[-1];value"
|
||||
ModelMap out = null;
|
||||
Collection in = (Collection)newWithElement(source());
|
||||
Collection in = List.of(source());
|
||||
out.addAllAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;ModelMap;false;addAllAttributes;(Collection);;Element of Argument[0];MapValue of ReturnValue;value"
|
||||
ModelMap out = null;
|
||||
Collection in = (Collection)newWithElement(source());
|
||||
Collection in = List.of(source());
|
||||
ModelMap instance = null;
|
||||
out = instance.addAllAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
@@ -427,14 +431,14 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;ModelMap;false;addAllAttributes;(Map);;MapKey of Argument[0];MapKey of Argument[-1];value"
|
||||
ModelMap out = null;
|
||||
Map in = (Map)newWithMapKey(source());
|
||||
Map in = Map.of(source(), null);
|
||||
out.addAllAttributes(in);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;ModelMap;false;addAllAttributes;(Map);;MapKey of Argument[0];MapKey of ReturnValue;value"
|
||||
ModelMap out = null;
|
||||
Map in = (Map)newWithMapKey(source());
|
||||
Map in = Map.of(source(), null);
|
||||
ModelMap instance = null;
|
||||
out = instance.addAllAttributes(in);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
@@ -442,14 +446,14 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;ModelMap;false;addAllAttributes;(Map);;MapValue of Argument[0];MapValue of Argument[-1];value"
|
||||
ModelMap out = null;
|
||||
Map in = (Map)newWithMapValue(source());
|
||||
Map in = Map.of(null, source());
|
||||
out.addAllAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;ModelMap;false;addAllAttributes;(Map);;MapValue of Argument[0];MapValue of ReturnValue;value"
|
||||
ModelMap out = null;
|
||||
Map in = (Map)newWithMapValue(source());
|
||||
Map in = Map.of(null, source());
|
||||
ModelMap instance = null;
|
||||
out = instance.addAllAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
@@ -530,7 +534,7 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;ModelMap;false;getAttribute;;;MapValue of Argument[-1];ReturnValue;value"
|
||||
Object out = null;
|
||||
ModelMap in = (ModelMap)newWithMapValue(source());
|
||||
ModelMap in = new ModelMap(null, source());
|
||||
out = in.getAttribute(null);
|
||||
sink(out); // $hasValueFlow
|
||||
}
|
||||
@@ -544,32 +548,32 @@ public class Test {
|
||||
{
|
||||
// "org.springframework.ui;ModelMap;false;mergeAttributes;;;MapKey of Argument[-1];MapKey of ReturnValue;value"
|
||||
ModelMap out = null;
|
||||
ModelMap in = (ModelMap)newWithMapKey(source());
|
||||
ModelMap in = new ModelMap((String)source(), null);
|
||||
out = in.mergeAttributes(null);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;ModelMap;false;mergeAttributes;;;MapKey of Argument[0];MapKey of Argument[-1];value"
|
||||
ModelMap out = null;
|
||||
Map in = (Map)newWithMapKey(source());
|
||||
Map in = Map.of(source(), null);
|
||||
out.mergeAttributes(in);
|
||||
sink(getMapKey(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;ModelMap;false;mergeAttributes;;;MapValue of Argument[-1];MapValue of ReturnValue;value"
|
||||
ModelMap out = null;
|
||||
ModelMap in = (ModelMap)newWithMapValue(source());
|
||||
ModelMap in = new ModelMap(null, source());
|
||||
out = in.mergeAttributes(null);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
{
|
||||
// "org.springframework.ui;ModelMap;false;mergeAttributes;;;MapValue of Argument[0];MapValue of Argument[-1];value"
|
||||
ModelMap out = null;
|
||||
Map in = (Map)newWithMapValue(source());
|
||||
Map in = Map.of(null, source());
|
||||
out.mergeAttributes(in);
|
||||
sink(getMapValue(out)); // $hasValueFlow
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,8 @@
|
||||
import java
|
||||
import semmle.code.java.dataflow.DataFlow
|
||||
import semmle.code.java.dataflow.ExternalFlow
|
||||
import semmle.code.java.dataflow.TaintTracking
|
||||
import TestUtilities.InlineExpectationsTest
|
||||
|
||||
class SummaryModelTest extends SummaryModelCsv {
|
||||
override predicate row(string row) {
|
||||
row =
|
||||
[
|
||||
//"package;type;overrides;name;signature;ext;inputspec;outputspec;kind",
|
||||
"generatedtest;Test;false;getMapKey;;;MapKey of Argument[0];ReturnValue;value",
|
||||
"generatedtest;Test;false;newWithMapKey;;;Argument[0];MapKey of ReturnValue;value",
|
||||
"generatedtest;Test;false;newWithElement;;;Argument[0];Element of ReturnValue;value",
|
||||
"generatedtest;Test;false;getMapValue;;;MapValue of Argument[0];ReturnValue;value",
|
||||
"generatedtest;Test;false;newWithMapValue;;;Argument[0];MapValue of ReturnValue;value"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
class ValueFlowConf extends DataFlow::Configuration {
|
||||
ValueFlowConf() { this = "qltest:valueFlowConf" }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user