mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
Model constructors of classes implementing MultivaluedMap
This commit is contained in:
@@ -476,6 +476,40 @@ private class MultivaluedMapModel extends SummaryModelCsv {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Model AbstractMultivaluedMap, which implements MultivaluedMap.
|
||||
*/
|
||||
private class AbstractMultivaluedMapModel extends SummaryModelCsv {
|
||||
override predicate row(string row) {
|
||||
row =
|
||||
[
|
||||
"javax.ws.rs.core;AbstractMultivaluedMap;false;AbstractMultivaluedMap;;;MapKey of Argument[0];MapKey of Argument[-1];value",
|
||||
"javax.ws.rs.core;AbstractMultivaluedMap;false;AbstractMultivaluedMap;;;MapValue of Argument[0];MapValue of Argument[-1];value",
|
||||
"jakarta.ws.rs.core;AbstractMultivaluedMap;false;AbstractMultivaluedMap;;;MapKey of Argument[0];MapKey of Argument[-1];value",
|
||||
"jakarta.ws.rs.core;AbstractMultivaluedMap;false;AbstractMultivaluedMap;;;MapValue of Argument[0];MapValue of Argument[-1];value"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Model MultivaluedHashMap, which extends AbstractMultivaluedMap.
|
||||
*/
|
||||
private class MultivaluedHashMapModel extends SummaryModelCsv {
|
||||
override predicate row(string row) {
|
||||
row =
|
||||
[
|
||||
"javax.ws.rs.core;MultivaluedHashMap;false;MultivaluedHashMap;(Map);;MapKey of Argument[0];MapKey of Argument[-1];value",
|
||||
"javax.ws.rs.core;MultivaluedHashMap;false;MultivaluedHashMap;(Map);;MapValue of Argument[0];Element of MapValue of Argument[-1];value",
|
||||
"javax.ws.rs.core;MultivaluedHashMap;false;MultivaluedHashMap;(MultivaluedMap);;MapKey of Argument[0];MapKey of Argument[-1];value",
|
||||
"javax.ws.rs.core;MultivaluedHashMap;false;MultivaluedHashMap;(MultivaluedMap);;MapValue of Argument[0];MapValue of Argument[-1];value",
|
||||
"jakarta.ws.rs.core;MultivaluedHashMap;false;MultivaluedHashMap;(Map);;MapKey of Argument[0];MapKey of Argument[-1];value",
|
||||
"jakarta.ws.rs.core;MultivaluedHashMap;false;MultivaluedHashMap;(Map);;MapValue of Argument[0];Element of MapValue of Argument[-1];value",
|
||||
"jakarta.ws.rs.core;MultivaluedHashMap;false;MultivaluedHashMap;(MultivaluedMap);;MapKey of Argument[0];MapKey of Argument[-1];value",
|
||||
"jakarta.ws.rs.core;MultivaluedHashMap;false;MultivaluedHashMap;(MultivaluedMap);;MapValue of Argument[0];MapValue of Argument[-1];value"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Model PathSegment, which wraps a path and its associated matrix parameters.
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import jakarta.ws.rs.core.AbstractMultivaluedMap;
|
||||
import jakarta.ws.rs.core.CacheControl;
|
||||
import jakarta.ws.rs.core.Cookie;
|
||||
import jakarta.ws.rs.core.EntityTag;
|
||||
@@ -15,6 +16,7 @@ import jakarta.ws.rs.core.GenericEntity;
|
||||
import jakarta.ws.rs.core.HttpHeaders;
|
||||
import jakarta.ws.rs.core.Link;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import jakarta.ws.rs.core.MultivaluedHashMap;
|
||||
import jakarta.ws.rs.core.MultivaluedMap;
|
||||
import jakarta.ws.rs.core.NewCookie;
|
||||
import jakarta.ws.rs.core.PathSegment;
|
||||
@@ -149,6 +151,42 @@ public class JakartaRsFlow {
|
||||
sink(mm2.get("key").get(0)); // $hasValueFlow
|
||||
}
|
||||
|
||||
class MyAbstractMultivaluedMapJak<K, V> extends AbstractMultivaluedMap<K, V> {
|
||||
public MyAbstractMultivaluedMapJak(Map<K, List<V>> map) {
|
||||
super(map);
|
||||
}
|
||||
}
|
||||
|
||||
void testAbstractMultivaluedMap(Map<String, List<String>> map1, Map<String, List<String>> map2, List<String> list) {
|
||||
map1.put(taint(), list);
|
||||
AbstractMultivaluedMap<String, String> amm1 = new MyAbstractMultivaluedMapJak<String, String>(map1);
|
||||
sink(amm1.keySet().iterator().next()); // $hasValueFlow
|
||||
|
||||
list.add(taint());
|
||||
map2.put("key", list);
|
||||
AbstractMultivaluedMap<String, String> amm2 = new MyAbstractMultivaluedMapJak<String, String>(map2);
|
||||
sink(amm2.get("key").get(0)); // $hasValueFlow
|
||||
}
|
||||
|
||||
void testMultivaluedHashMap(Map<String, String> map1, Map<String, String> map2,
|
||||
MultivaluedMap<String, String> mm1, MultivaluedMap<String, String> mm2) {
|
||||
map1.put(taint(), "value");
|
||||
MultivaluedHashMap<String, String> mhm1 = new MultivaluedHashMap<String, String>(map1);
|
||||
sink(mhm1.keySet().iterator().next()); // $hasValueFlow
|
||||
|
||||
map2.put("key", taint());
|
||||
MultivaluedHashMap<String, String> mhm2 = new MultivaluedHashMap<String, String>(map2);
|
||||
sink(mhm2.get("key").get(0)); // $hasValueFlow
|
||||
|
||||
mm1.add(taint(), "value");
|
||||
MultivaluedHashMap<String, String> mhm3 = new MultivaluedHashMap<String, String>(mm1);
|
||||
sink(mhm3.keySet().iterator().next()); // $hasValueFlow
|
||||
|
||||
mm2.add("key", taint());
|
||||
MultivaluedHashMap<String, String> mhm4 = new MultivaluedHashMap<String, String>(mm2);
|
||||
sink(mhm4.get("key").get(0)); // $hasValueFlow
|
||||
}
|
||||
|
||||
void testPathSegment(PathSegment ps1, PathSegment ps2) {
|
||||
sink(taint(ps1).getMatrixParameters()); // $hasTaintFlow
|
||||
sink(taint(ps2).getPath()); // $hasTaintFlow
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.ws.rs.core.AbstractMultivaluedMap;
|
||||
import javax.ws.rs.core.CacheControl;
|
||||
import javax.ws.rs.core.Cookie;
|
||||
import javax.ws.rs.core.EntityTag;
|
||||
@@ -15,6 +16,7 @@ import javax.ws.rs.core.GenericEntity;
|
||||
import javax.ws.rs.core.HttpHeaders;
|
||||
import javax.ws.rs.core.Link;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.MultivaluedHashMap;
|
||||
import javax.ws.rs.core.MultivaluedMap;
|
||||
import javax.ws.rs.core.NewCookie;
|
||||
import javax.ws.rs.core.PathSegment;
|
||||
@@ -149,6 +151,42 @@ public class JaxRsFlow {
|
||||
sink(mm2.get("key").get(0)); // $hasValueFlow
|
||||
}
|
||||
|
||||
class MyAbstractMultivaluedMap<K, V> extends AbstractMultivaluedMap<K, V> {
|
||||
public MyAbstractMultivaluedMap(Map<K, List<V>> map) {
|
||||
super(map);
|
||||
}
|
||||
}
|
||||
|
||||
void testAbstractMultivaluedMap(Map<String, List<String>> map1, Map<String, List<String>> map2, List<String> list) {
|
||||
map1.put(taint(), list);
|
||||
AbstractMultivaluedMap<String, String> amm1 = new MyAbstractMultivaluedMap<String, String>(map1);
|
||||
sink(amm1.keySet().iterator().next()); // $hasValueFlow
|
||||
|
||||
list.add(taint());
|
||||
map2.put("key", list);
|
||||
AbstractMultivaluedMap<String, String> amm2 = new MyAbstractMultivaluedMap<String, String>(map2);
|
||||
sink(amm2.get("key").get(0)); // $hasValueFlow
|
||||
}
|
||||
|
||||
void testMultivaluedHashMap(Map<String, String> map1, Map<String, String> map2,
|
||||
MultivaluedMap<String, String> mm1, MultivaluedMap<String, String> mm2) {
|
||||
map1.put(taint(), "value");
|
||||
MultivaluedHashMap<String, String> mhm1 = new MultivaluedHashMap<String, String>(map1);
|
||||
sink(mhm1.keySet().iterator().next()); // $hasValueFlow
|
||||
|
||||
map2.put("key", taint());
|
||||
MultivaluedHashMap<String, String> mhm2 = new MultivaluedHashMap<String, String>(map2);
|
||||
sink(mhm2.get("key").get(0)); // $hasValueFlow
|
||||
|
||||
mm1.add(taint(), "value");
|
||||
MultivaluedHashMap<String, String> mhm3 = new MultivaluedHashMap<String, String>(mm1);
|
||||
sink(mhm3.keySet().iterator().next()); // $hasValueFlow
|
||||
|
||||
mm2.add("key", taint());
|
||||
MultivaluedHashMap<String, String> mhm4 = new MultivaluedHashMap<String, String>(mm2);
|
||||
sink(mhm4.get("key").get(0)); // $hasValueFlow
|
||||
}
|
||||
|
||||
void testPathSegment(PathSegment ps1, PathSegment ps2) {
|
||||
sink(taint(ps1).getMatrixParameters()); // $hasTaintFlow
|
||||
sink(taint(ps2).getPath()); // $hasTaintFlow
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2017 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v. 2.0, which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* This Source Code may also be made available under the following Secondary
|
||||
* Licenses when the conditions for such availability set forth in the
|
||||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||
* version 2 with the GNU Classpath Exception, which is available at
|
||||
* https://www.gnu.org/software/classpath/license.html.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||
*/
|
||||
|
||||
package javax.ws.rs.core;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class AbstractMultivaluedMap<K, V> implements MultivaluedMap<K, V> {
|
||||
public AbstractMultivaluedMap(Map<K, List<V>> store) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void putSingle(K key, V value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void add(K key, V value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void addAll(K key, V... newValues) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void addAll(K key, List<V> valueList) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final V getFirst(K key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void addFirst(K key, V value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<List<V>> values() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> remove(Object key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(Map<? extends K, ? extends List<V>> m) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> put(K key, List<V> value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<K> keySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> get(Object key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<K, List<V>>> entrySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsIgnoreValueOrder(MultivaluedMap<K, V> omap) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2017 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v. 2.0, which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* This Source Code may also be made available under the following Secondary
|
||||
* Licenses when the conditions for such availability set forth in the
|
||||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||
* version 2 with the GNU Classpath Exception, which is available at
|
||||
* https://www.gnu.org/software/classpath/license.html.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||
*/
|
||||
|
||||
package javax.ws.rs.core;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MultivaluedHashMap<K, V> extends AbstractMultivaluedMap<K, V> implements Serializable {
|
||||
// public MultivaluedHashMap() {
|
||||
// }
|
||||
|
||||
// public MultivaluedHashMap(int initialCapacity) {
|
||||
// }
|
||||
|
||||
// public MultivaluedHashMap(int initialCapacity, float loadFactor) {
|
||||
// }
|
||||
|
||||
public MultivaluedHashMap(MultivaluedMap<? extends K, ? extends V> map) {
|
||||
super(new HashMap<K, List<V>>());
|
||||
}
|
||||
|
||||
public MultivaluedHashMap(Map<? extends K, ? extends V> map) {
|
||||
super(new HashMap<K, List<V>>());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v. 2.0, which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* This Source Code may also be made available under the following Secondary
|
||||
* Licenses when the conditions for such availability set forth in the
|
||||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||
* version 2 with the GNU Classpath Exception, which is available at
|
||||
* https://www.gnu.org/software/classpath/license.html.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||
*/
|
||||
|
||||
package jakarta.ws.rs.core;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class AbstractMultivaluedMap<K, V> implements MultivaluedMap<K, V>, Serializable {
|
||||
public AbstractMultivaluedMap(final Map<K, List<V>> store) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void putSingle(final K key, final V value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void add(final K key, final V value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void addAll(final K key, final V... newValues) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void addAll(final K key, final List<V> valueList) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final V getFirst(final K key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void addFirst(final K key, final V value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<List<V>> values() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> remove(final Object key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(final Map<? extends K, ? extends List<V>> m) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> put(final K key, final List<V> value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<K> keySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<V> get(final Object key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Entry<K, List<V>>> entrySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(final Object value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(final Object key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsIgnoreValueOrder(final MultivaluedMap<K, V> omap) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2019 Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v. 2.0, which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0.
|
||||
*
|
||||
* This Source Code may also be made available under the following Secondary
|
||||
* Licenses when the conditions for such availability set forth in the
|
||||
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
|
||||
* version 2 with the GNU Classpath Exception, which is available at
|
||||
* https://www.gnu.org/software/classpath/license.html.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
||||
*/
|
||||
|
||||
package jakarta.ws.rs.core;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MultivaluedHashMap<K, V> extends AbstractMultivaluedMap<K, V> implements Serializable {
|
||||
// public MultivaluedHashMap() {
|
||||
// }
|
||||
|
||||
// public MultivaluedHashMap(final int initialCapacity) {
|
||||
// }
|
||||
|
||||
// public MultivaluedHashMap(final int initialCapacity, final float loadFactor) {
|
||||
// }
|
||||
|
||||
public MultivaluedHashMap(final MultivaluedMap<? extends K, ? extends V> map) {
|
||||
super(new HashMap<K, List<V>>());
|
||||
}
|
||||
|
||||
public MultivaluedHashMap(final Map<? extends K, ? extends V> map) {
|
||||
super(new HashMap<K, List<V>>());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user