Skip to content

Java: Clean up ContainerFlow, consider more methods #3883

@Marcono1234

Description

@Marcono1234

Description

Would it be possible to clean up ContainerFlow.qll by grouping methods in taintPreservingQualifierToMethod and taintPreservingArgumentToQualifier by declaring type, and to include currently missing methods?

The following lists methods for which it would be good if they were covered. For completeness it also lists methods already covered. It is based on JDK 14.

This list currently contains Map and Map.Entry methods which get or set entry keys, however this might not be desired, see also #3869 (comment). These methods are enclosed in square brackets ([...]).
It also cotains toString() of the AbstractX classes, though this might not be desired, see #3894 (comment).

Proposed methods to cover

taintPreservingQualifierToMethod

Maybe in general taint tracking should consider clone() calls in case it does not yet.

  • java.util.Iterable

    • iterator()
    • spliterator()
  • java.util.Collection

    • parallelStream()
    • stream()
    • toArray()
    • toArray(IntFunction<T[]>)
    • toArray([]T)
      Additionally argument should be tainted because, if big enough, elements will be stored in it
  • java.util.AbstractCollection

    • toString()
      Because it is explicitly specified that the string contains string representations of the elements
  • java.util.List

    • get(int)
    • listIterator()
    • listIterator(int)
    • remove(int)
      Returns old value
    • set(int, E)
      Returns old value
    • subList(int, int)
  • java.util.Vector

    • ? copyInto(Object[])
      Argument should be tainted
    • elementAt(int)
    • elements()
    • firstElement()
    • lastElement()
  • java.util.Stack

    • peek()
    • pop()
    • push(E)
      Returns the arguments
  • java.util.Queue

    • element()
    • peek()
    • poll()
    • remove()
  • java.util.Deque

    • getFirst()
    • getLast()
    • peekFirst()
    • peekLast()
    • pollFirst()
    • pollLast()
    • removeFirst()
    • removeLast()
  • java.util.concurrent.BlockingQueue

    • ? drainTo(Collection<? super E>)
      Argument should be tainted
    • ? drainTo(Collection<? super E>, int)
      Argument should be tainted
    • poll(long, TimeUnit)
    • take()
  • java.util.concurrent.BlockingDeque

    • pollFirst(long, TimeUnit)
    • pollLast(long, TimeUnit)
    • takeFirst()
    • takeLast()
  • java.util.SortedSet

    • first()
    • headSet(E)
    • last()
    • subSet(E, E)
    • tailSet(E)
  • java.util.NavigableSet

    • ceiling(E)
    • descendingIterator()
    • descendingSet()
    • floor(E)
    • headSet(E, boolean)
    • higher(E)
    • lower(E)
    • pollFirst()
    • pollLast()
    • subSet(E, boolean, E, boolean)
    • tailSet(E, boolean)
  • java.util.Map.Entry

    • [getKey()]
    • getValue()
    • setValue(V)
      Returns old value
  • java.util.AbstractMap.SimpleEntry

    • toString()
      Because it is explicitly specified that the string contains string representations of the entry
  • java.util.Map

    • compute(K, BiFunction<? super K, ? super V, ? extends V>)
      Return value can be based on old value
    • computeIfAbsent(K, Function<? super K, ? extends V>)
      Can return old value
    • computeIfPresent(K, BiFunction<? super K, ? super V, ? extends V>)
      Return value can be based on old value
    • entrySet()
    • get(Object)
    • getOrDefault(Object, V)
    • [keySet()]
    • merge(K, V, BiFunction<? super V, ? super V, ? extends V>)
      Return value can be based on old value
    • put(K, V)
      Returns old value
    • putIfAbsent(K, V)
      Returns old value
    • remove(Object)
      Returns old value
    • replace(K, V)
      Returns old value
    • values()
  • java.util.AbstractMap

    • toString()
      Because it is explicitly specified that the string contains string representations of the entries
  • java.util.SortedMap

    • [firstKey()]
    • headMap(K)
    • [lastKey()]
    • subMap(K, K)
    • tailMap(K)
  • java.util.NavigableMap

    • ceilingEntry(K)
    • [ceilingKey(K)]
    • [descendingKeySet()]
    • descendingMap()
    • firstEntry()
    • floorEntry(K)
    • [floorKey(K)]
    • headMap(K, boolean)
    • higherEntry(K)
    • [higherKey(K)]
    • lastEntry()
    • lowerEntry(K)
    • [lowerKey(K)]
    • [navigableKeySet()]
    • pollFirstEntry()
    • pollLastEntry()
    • subMap(K, boolean, K, boolean)
    • tailMap(K, boolean)
  • java.util.concurrent.ConcurrentHashMap

    • elements()
    • [keys()]
    • [keySet(V)]
    • reduce(long, BiFunction<? super K, ? super V, ? extends U>, BiFunction<? super U, ? super U, ? extends U>)
    • reduceEntries(long, BiFunction<Map.Entry<K, V>, Map.Entry<K, V>, ? extends Map.Entry<K, V>>)
    • reduceEntriesToDouble(long, ToDoubleFunction<Map.Entry<K, V>>, double, DoubleBinaryOperator)
    • reduceEntriesToInt(long, ToIntFunction<Map.Entry<K, V>>, int, IntBinaryOperator)
    • reduceEntriesToLong(long, ToLongFunction<Map.Entry<K, V>>, long, LongBinaryOperator)
    • [reduceKeys(long, BiFunction<? super K, ? super K, ? extends K>)]
    • [reduceKeys(long, Function<? super K, ? extends U>, BiFunction<? super U, ? super U, ? extends U>)]
    • [reduceKeysToDouble(long, ToDoubleFunction<? super K>, double, DoubleBinaryOperator)]
    • [reduceKeysToInt(long, ToIntFunction<? super K>, int, IntBinaryOperator)]
    • [reduceKeysToLong(long, ToLongFunction<? super K>, long, LongBinaryOperator)]
    • [reduceToDouble(long, ToDoubleBiFunction<? super K, ? super V>, double, DoubleBinaryOperator)]
    • [reduceToInt(long, ToIntBiFunction<? super K, ? super V>, int, IntBinaryOperator)]
    • [reduceToLong(long, ToLongBiFunction<? super K, ? super V>, long, LongBinaryOperator)]
    • reduceValues(long, Function<? super V, ? extends U>, BiFunction<? super U, ? super U, ? extends U>)
    • reduceValuesToDouble(long, ToDoubleFunction<? super V>, double, DoubleBinaryOperator)
    • reduceValuesToInt(long, ToIntFunction<? super V>, int, IntBinaryOperator)
    • reduceValuesToLong(long, ToLongFunction<? super V>, long, LongBinaryOperator)
    • search(long, BiFunction<? super K, ? super V, ? extends U>)
    • searchEntries(long, Function<Map.Entry<K, V>, ? extends U>)
    • [searchKeys(long, Function<? super K, ? extends U>)]
    • searchValues(long, Function<? super V, ? extends U>)
  • java.util.Dictionary

    • elements()
    • get(Object)
    • [keys()]
    • put(K, V)
      Returns old value
    • remove(Object)
      Returns old value
  • java.util.Iterator

    • next()
  • java.util.ListIterator

    • previous()
  • java.util.Enumeration

    • asIterator()
    • nextElement()

taintPreservingArgumentToQualifier

  • java.util.Collection

    • add(E)
    • addAll(Collection<? extends E>)
  • java.util.List

    • add(int, E)
    • addAll(int, Collection<? extends E>)
    • ? replaceAll(UnaryOperator<E>)
    • set(int, E)
  • java.util.Vector

    • addElement(E)
    • insertElementAt(E, int)
    • setElementAt(E, int)
  • java.util.Stack

    • push(E)
  • java.util.Queue

    • offer(E)
  • java.util.Deque

    • addFirst(E)
    • addLast(E)
    • offerFirst(E)
    • offerLast(E)
    • push(E)
  • java.util.concurrent.BlockingQueue

    • offer(E, long, TimeUnit)
    • put(E)
  • java.util.concurrent.TransferQueue

    • transfer(E)
    • tryTransfer(E)
    • tryTransfer(E, long, TimeUnit)
  • java.util.concurrent.BlockingDeque

    • offerFirst(E, long, TimeUnit)
    • offerLast(E, long, TimeUnit)
    • putFirst(E)
    • putLast(E)
  • java.util.Map.Entry

    • setValue(V)
  • java.util.Map

    • ? compute(K, BiFunction<? super K, ? super V, ? extends V>)
    • ? computeIfAbsent(K, Function<? super K, ? extends V>)
    • ? computeIfPresent(K, BiFunction<? super K, ? super V, ? extends V>)
    • merge(K, V, BiFunction<? super V, ? super V, ? extends V>)
    • put(K, V)
    • putAll(Map<? extends K, ? extends V>)
    • putIfAbsent(K, V)
    • replace(K, V)
    • replace(K, V, V)
    • ? replaceAll(BiFunction<? super K, ? super V, ? extends V>)
  • java.util.Dictionary

    • put(K, V)
  • java.util.ListIterator

    • add(E)
    • set(E)

Metadata

Metadata

Assignees

Labels

JavaquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions