mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
C#: Re-factor the model generator tests.
This commit is contained in:
@@ -3,4 +3,4 @@ extensions:
|
||||
pack: codeql/csharp-all
|
||||
extensible: neutralModel
|
||||
data:
|
||||
- [ "NoSummaries", "ManuallyModelled", "HasNeutralSummaryNoFlow", "(System.Object)", "summary", "manual"]
|
||||
- [ "Models", "ManuallyModelled", "HasNeutralSummaryNoFlow", "(System.Object)", "summary", "manual"]
|
||||
|
||||
@@ -3,10 +3,10 @@ extensions:
|
||||
pack: codeql/csharp-all
|
||||
extensible: summaryModel
|
||||
data:
|
||||
- [ "NoSummaries", "ManuallyModelled", False, "HasSummary", "(System.Object)", "", "Argument[0]", "ReturnValue", "value", "manual"]
|
||||
- [ "Models", "ManuallyModelled", False, "HasSummary", "(System.Object)", "", "Argument[0]", "ReturnValue", "value", "manual"]
|
||||
|
||||
- addsTo:
|
||||
pack: codeql/csharp-all
|
||||
extensible: neutralModel
|
||||
data:
|
||||
- [ "NoSummaries", "ManuallyModelled", "HasNeutralSummary", "(System.Object)", "summary", "manual"]
|
||||
- [ "Models", "ManuallyModelled", "HasNeutralSummary", "(System.Object)", "summary", "manual"]
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NoSummaries;
|
||||
|
||||
// Single class with a method that produces a flow summary.
|
||||
// Just to prove that, if a method like this is correctly exposed, a flow summary will be captured.
|
||||
public class PublicClassFlow
|
||||
{
|
||||
// summary=NoSummaries;PublicClassFlow;false;PublicReturn;(System.Object);;Argument[0];ReturnValue;taint;df-generated
|
||||
public object PublicReturn(object input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class PublicClassNoFlow
|
||||
{
|
||||
private object PrivateReturn(object input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
internal object InternalReturn(object input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
private class PrivateClassNoFlow
|
||||
{
|
||||
public object ReturnParam(object input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
private class PrivateClassNestedPublicClassNoFlow
|
||||
{
|
||||
public class NestedPublicClassFlow
|
||||
{
|
||||
public object ReturnParam(object input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class EquatableBound : IEquatable<object>
|
||||
{
|
||||
public readonly bool tainted;
|
||||
|
||||
// neutral=NoSummaries;EquatableBound;Equals;(System.Object);summary;df-generated
|
||||
public bool Equals(object other)
|
||||
{
|
||||
return tainted;
|
||||
}
|
||||
}
|
||||
|
||||
public class EquatableUnBound<T> : IEquatable<T>
|
||||
{
|
||||
public readonly bool tainted;
|
||||
|
||||
// neutral=NoSummaries;EquatableUnBound<T>;Equals;(T);summary;df-generated
|
||||
public bool Equals(T? other)
|
||||
{
|
||||
return tainted;
|
||||
}
|
||||
}
|
||||
|
||||
// No methods in this class will have generated flow summaries as
|
||||
// simple types are used.
|
||||
public class SimpleTypes
|
||||
{
|
||||
// neutral=NoSummaries;SimpleTypes;M1;(System.Boolean);summary;df-generated
|
||||
public bool M1(bool b)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
// neutral=NoSummaries;SimpleTypes;M2;(System.Boolean);summary;df-generated
|
||||
public Boolean M2(Boolean b)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
// neutral=NoSummaries;SimpleTypes;M3;(System.Int32);summary;df-generated
|
||||
public int M3(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
// neutral=NoSummaries;SimpleTypes;M4;(System.Int32);summary;df-generated
|
||||
public Int32 M4(Int32 i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
public class HigherOrderParameters
|
||||
{
|
||||
public string M1(string s, Func<string, string> map)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
public object M2(Func<object, object> map, object o)
|
||||
{
|
||||
return map(o);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class BaseClass
|
||||
{
|
||||
// neutral=NoSummaries;BaseClass;M1;(System.String);summary;df-generated
|
||||
public virtual string M1(string s)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
// neutral=NoSummaries;BaseClass;M2;(System.String);summary;df-generated
|
||||
public abstract string M2(string s);
|
||||
}
|
||||
|
||||
// No methods in this class will have generated flow as
|
||||
// the simple types used in the collection are not bulk data types.
|
||||
public class CollectionFlow
|
||||
{
|
||||
// neutral=NoSummaries;CollectionFlow;ReturnSimpleTypeArray;(System.Int32[]);summary;df-generated
|
||||
public int[] ReturnSimpleTypeArray(int[] a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
// neutral=NoSummaries;CollectionFlow;ReturnSimpleTypeList;(System.Collections.Generic.List<System.Int32>);summary;df-generated
|
||||
public List<int> ReturnSimpleTypeList(List<int> a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
// neutral=NoSummaries;CollectionFlow;ReturnSimpleTypeDictionary;(System.Collections.Generic.Dictionary<System.Int32,System.Int32>);summary;df-generated
|
||||
public Dictionary<int, int> ReturnSimpleTypeDictionary(Dictionary<int, int> a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
// A neutral model should not be created for a parameterless constructor.
|
||||
public class ParameterlessConstructor
|
||||
{
|
||||
public bool IsInitialized;
|
||||
|
||||
public ParameterlessConstructor()
|
||||
{
|
||||
IsInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
// No models should be created, if there exist either a manual summary or neutral summary.
|
||||
public class ManuallyModelled
|
||||
{
|
||||
public object HasSummary(object o)
|
||||
{
|
||||
return o;
|
||||
}
|
||||
|
||||
public object HasNeutralSummary(object o)
|
||||
{
|
||||
return o;
|
||||
}
|
||||
|
||||
public object HasNeutralSummaryNoFlow(object o)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class Properties
|
||||
{
|
||||
public object backingField;
|
||||
public object Prop
|
||||
{
|
||||
get { return backingField; }
|
||||
set { backingField = value; }
|
||||
}
|
||||
}
|
||||
@@ -3,53 +3,53 @@ using System.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Summaries;
|
||||
namespace Models;
|
||||
|
||||
public class BasicFlow
|
||||
{
|
||||
// No flow summary and no negative summary either.
|
||||
// No model as destructors are excluded from model generation.
|
||||
~BasicFlow() { }
|
||||
|
||||
private string tainted;
|
||||
|
||||
// summary=Summaries;BasicFlow;false;ReturnThis;(System.Object);;Argument[this];ReturnValue;value;df-generated
|
||||
// summary=Models;BasicFlow;false;ReturnThis;(System.Object);;Argument[this];ReturnValue;value;df-generated
|
||||
public BasicFlow ReturnThis(object input)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
// summary=Summaries;BasicFlow;false;ReturnParam0;(System.String,System.Object);;Argument[0];ReturnValue;taint;df-generated
|
||||
// summary=Models;BasicFlow;false;ReturnParam0;(System.String,System.Object);;Argument[0];ReturnValue;taint;df-generated
|
||||
public string ReturnParam0(string input0, object input1)
|
||||
{
|
||||
return input0;
|
||||
}
|
||||
|
||||
// summary=Summaries;BasicFlow;false;ReturnParam1;(System.String,System.Object);;Argument[1];ReturnValue;taint;df-generated
|
||||
// summary=Models;BasicFlow;false;ReturnParam1;(System.String,System.Object);;Argument[1];ReturnValue;taint;df-generated
|
||||
public object ReturnParam1(string input0, object input1)
|
||||
{
|
||||
return input1;
|
||||
}
|
||||
|
||||
// summary=Summaries;BasicFlow;false;ReturnParamMultiple;(System.Object,System.Object);;Argument[0];ReturnValue;taint;df-generated
|
||||
// summary=Summaries;BasicFlow;false;ReturnParamMultiple;(System.Object,System.Object);;Argument[1];ReturnValue;taint;df-generated
|
||||
// summary=Models;BasicFlow;false;ReturnParamMultiple;(System.Object,System.Object);;Argument[0];ReturnValue;taint;df-generated
|
||||
// summary=Models;BasicFlow;false;ReturnParamMultiple;(System.Object,System.Object);;Argument[1];ReturnValue;taint;df-generated
|
||||
public object ReturnParamMultiple(object input0, object input1)
|
||||
{
|
||||
return (System.DateTime.Now.DayOfWeek == System.DayOfWeek.Monday) ? input0 : input1;
|
||||
}
|
||||
|
||||
// summary=Summaries;BasicFlow;false;ReturnSubstring;(System.String);;Argument[0];ReturnValue;taint;df-generated
|
||||
// summary=Models;BasicFlow;false;ReturnSubstring;(System.String);;Argument[0];ReturnValue;taint;df-generated
|
||||
public string ReturnSubstring(string s)
|
||||
{
|
||||
return s.Substring(0, 1);
|
||||
}
|
||||
|
||||
// summary=Summaries;BasicFlow;false;SetField;(System.String);;Argument[0];Argument[this];taint;df-generated
|
||||
// summary=Models;BasicFlow;false;SetField;(System.String);;Argument[0];Argument[this];taint;df-generated
|
||||
public void SetField(string s)
|
||||
{
|
||||
tainted = s;
|
||||
}
|
||||
|
||||
// summary=Summaries;BasicFlow;false;ReturnField;();;Argument[this];ReturnValue;taint;df-generated
|
||||
// summary=Models;BasicFlow;false;ReturnField;();;Argument[this];ReturnValue;taint;df-generated
|
||||
public string ReturnField()
|
||||
{
|
||||
return tainted;
|
||||
@@ -60,96 +60,118 @@ public class CollectionFlow
|
||||
{
|
||||
private string tainted;
|
||||
|
||||
// summary=Summaries;CollectionFlow;false;ReturnArrayElement;(System.Object[]);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
// summary=Models;CollectionFlow;false;ReturnArrayElement;(System.Object[]);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
public object ReturnArrayElement(object[] input)
|
||||
{
|
||||
return input[0];
|
||||
}
|
||||
|
||||
// summary=Summaries;CollectionFlow;false;AssignToArray;(System.Object,System.Object[]);;Argument[0];Argument[1].Element;taint;df-generated
|
||||
// summary=Models;CollectionFlow;false;AssignToArray;(System.Object,System.Object[]);;Argument[0];Argument[1].Element;taint;df-generated
|
||||
public void AssignToArray(object data, object[] target)
|
||||
{
|
||||
target[0] = data;
|
||||
}
|
||||
|
||||
// summary=Summaries;CollectionFlow;false;AssignFieldToArray;(System.Object[]);;Argument[this];Argument[0].Element;taint;df-generated
|
||||
// summary=Models;CollectionFlow;false;AssignFieldToArray;(System.Object[]);;Argument[this];Argument[0].Element;taint;df-generated
|
||||
public void AssignFieldToArray(object[] target)
|
||||
{
|
||||
target[0] = tainted;
|
||||
}
|
||||
|
||||
// summary=Summaries;CollectionFlow;false;ReturnListElement;(System.Collections.Generic.List<System.Object>);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
// summary=Models;CollectionFlow;false;ReturnListElement;(System.Collections.Generic.List<System.Object>);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
public object ReturnListElement(List<object> input)
|
||||
{
|
||||
return input[0];
|
||||
}
|
||||
|
||||
// summary=Summaries;CollectionFlow;false;AddToList;(System.Collections.Generic.List<System.Object>,System.Object);;Argument[1];Argument[0].Element;taint;df-generated
|
||||
// summary=Models;CollectionFlow;false;AddToList;(System.Collections.Generic.List<System.Object>,System.Object);;Argument[1];Argument[0].Element;taint;df-generated
|
||||
public void AddToList(List<object> input, object data)
|
||||
{
|
||||
input.Add(data);
|
||||
}
|
||||
|
||||
// summary=Summaries;CollectionFlow;false;AddFieldToList;(System.Collections.Generic.List<System.String>);;Argument[this];Argument[0].Element;taint;df-generated
|
||||
// summary=Models;CollectionFlow;false;AddFieldToList;(System.Collections.Generic.List<System.String>);;Argument[this];Argument[0].Element;taint;df-generated
|
||||
public void AddFieldToList(List<string> input)
|
||||
{
|
||||
input.Add(tainted);
|
||||
}
|
||||
|
||||
// summary=Summaries;CollectionFlow;false;ReturnFieldInAList;();;Argument[this];ReturnValue;taint;df-generated
|
||||
// summary=Models;CollectionFlow;false;ReturnFieldInAList;();;Argument[this];ReturnValue;taint;df-generated
|
||||
public List<string> ReturnFieldInAList()
|
||||
{
|
||||
return new List<string> { tainted };
|
||||
}
|
||||
|
||||
// summary=Summaries;CollectionFlow;false;ReturnComplexTypeArray;(System.String[]);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
// summary=Models;CollectionFlow;false;ReturnComplexTypeArray;(System.String[]);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
public string[] ReturnComplexTypeArray(string[] a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
// summary=Summaries;CollectionFlow;false;ReturnBulkTypeList;(System.Collections.Generic.List<System.Byte>);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
// summary=Models;CollectionFlow;false;ReturnBulkTypeList;(System.Collections.Generic.List<System.Byte>);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
public List<byte> ReturnBulkTypeList(List<byte> a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
// summary=Summaries;CollectionFlow;false;ReturnComplexTypeDictionary;(System.Collections.Generic.Dictionary<System.Int32,System.String>);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
// summary=Models;CollectionFlow;false;ReturnComplexTypeDictionary;(System.Collections.Generic.Dictionary<System.Int32,System.String>);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
public Dictionary<int, string> ReturnComplexTypeDictionary(Dictionary<int, string> a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
// summary=Summaries;CollectionFlow;false;ReturnUntypedArray;(System.Array);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
// summary=Models;CollectionFlow;false;ReturnUntypedArray;(System.Array);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
public Array ReturnUntypedArray(Array a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
// summary=Summaries;CollectionFlow;false;ReturnUntypedList;(System.Collections.IList);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
// summary=Models;CollectionFlow;false;ReturnUntypedList;(System.Collections.IList);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
public IList ReturnUntypedList(IList a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
// No flow as this is collection is of simple types.
|
||||
// neutral=Models;CollectionFlow;ReturnSimpleTypeArray;(System.Int32[]);summary;df-generated
|
||||
public int[] ReturnSimpleTypeArray(int[] a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
// No flow as this is collection is of simple types.
|
||||
// neutral=Models;CollectionFlow;ReturnSimpleTypeList;(System.Collections.Generic.List<System.Int32>);summary;df-generated
|
||||
public List<int> ReturnSimpleTypeList(List<int> a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
// No flow as this is collection is of simple types.
|
||||
// neutral=Models;CollectionFlow;ReturnSimpleTypeDictionary;(System.Collections.Generic.Dictionary<System.Int32,System.Int32>);summary;df-generated
|
||||
public Dictionary<int, int> ReturnSimpleTypeDictionary(Dictionary<int, int> a)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class IEnumerableFlow
|
||||
{
|
||||
private string tainted;
|
||||
|
||||
// summary=Summaries;IEnumerableFlow;false;ReturnIEnumerable;(System.Collections.Generic.IEnumerable<System.String>);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
// summary=Models;IEnumerableFlow;false;ReturnIEnumerable;(System.Collections.Generic.IEnumerable<System.String>);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
public IEnumerable<string> ReturnIEnumerable(IEnumerable<string> input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
// summary=Summaries;IEnumerableFlow;false;ReturnIEnumerableElement;(System.Collections.Generic.IEnumerable<System.Object>);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
// summary=Models;IEnumerableFlow;false;ReturnIEnumerableElement;(System.Collections.Generic.IEnumerable<System.Object>);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
public object ReturnIEnumerableElement(IEnumerable<object> input)
|
||||
{
|
||||
return input.First();
|
||||
}
|
||||
|
||||
// summary=Summaries;IEnumerableFlow;false;ReturnFieldInIEnumerable;();;Argument[this];ReturnValue;taint;df-generated
|
||||
// summary=Models;IEnumerableFlow;false;ReturnFieldInIEnumerable;();;Argument[this];ReturnValue;taint;df-generated
|
||||
public IEnumerable<string> ReturnFieldInIEnumerable()
|
||||
{
|
||||
return new List<string> { tainted };
|
||||
@@ -160,43 +182,43 @@ public class GenericFlow<T>
|
||||
{
|
||||
private T tainted;
|
||||
|
||||
// summary=Summaries;GenericFlow<T>;false;SetGenericField;(T);;Argument[0];Argument[this];taint;df-generated
|
||||
// summary=Models;GenericFlow<T>;false;SetGenericField;(T);;Argument[0];Argument[this];taint;df-generated
|
||||
public void SetGenericField(T t)
|
||||
{
|
||||
tainted = t;
|
||||
}
|
||||
|
||||
// summary=Summaries;GenericFlow<T>;false;ReturnGenericField;();;Argument[this];ReturnValue;taint;df-generated
|
||||
// summary=Models;GenericFlow<T>;false;ReturnGenericField;();;Argument[this];ReturnValue;taint;df-generated
|
||||
public T ReturnGenericField()
|
||||
{
|
||||
return tainted;
|
||||
}
|
||||
|
||||
// summary=Summaries;GenericFlow<T>;false;AddFieldToGenericList;(System.Collections.Generic.List<T>);;Argument[this];Argument[0].Element;taint;df-generated
|
||||
// summary=Models;GenericFlow<T>;false;AddFieldToGenericList;(System.Collections.Generic.List<T>);;Argument[this];Argument[0].Element;taint;df-generated
|
||||
public void AddFieldToGenericList(List<T> input)
|
||||
{
|
||||
input.Add(tainted);
|
||||
}
|
||||
|
||||
// summary=Summaries;GenericFlow<T>;false;ReturnFieldInGenericList;();;Argument[this];ReturnValue;taint;df-generated
|
||||
// summary=Models;GenericFlow<T>;false;ReturnFieldInGenericList;();;Argument[this];ReturnValue;taint;df-generated
|
||||
public List<T> ReturnFieldInGenericList()
|
||||
{
|
||||
return new List<T> { tainted };
|
||||
}
|
||||
|
||||
// summary=Summaries;GenericFlow<T>;false;ReturnGenericParam<S>;(S);;Argument[0];ReturnValue;taint;df-generated
|
||||
// summary=Models;GenericFlow<T>;false;ReturnGenericParam<S>;(S);;Argument[0];ReturnValue;taint;df-generated
|
||||
public S ReturnGenericParam<S>(S input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
// summary=Summaries;GenericFlow<T>;false;ReturnGenericElement<S>;(System.Collections.Generic.List<S>);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
// summary=Models;GenericFlow<T>;false;ReturnGenericElement<S>;(System.Collections.Generic.List<S>);;Argument[0].Element;ReturnValue;taint;df-generated
|
||||
public S ReturnGenericElement<S>(List<S> input)
|
||||
{
|
||||
return input[0];
|
||||
}
|
||||
|
||||
// summary=Summaries;GenericFlow<T>;false;AddToGenericList<S>;(System.Collections.Generic.List<S>,S);;Argument[1];Argument[0].Element;taint;df-generated
|
||||
// summary=Models;GenericFlow<T>;false;AddToGenericList<S>;(System.Collections.Generic.List<S>,S);;Argument[1];Argument[0].Element;taint;df-generated
|
||||
public void AddToGenericList<S>(List<S> input, S data)
|
||||
{
|
||||
input.Add(data);
|
||||
@@ -205,7 +227,7 @@ public class GenericFlow<T>
|
||||
|
||||
public abstract class BaseClassFlow
|
||||
{
|
||||
// summary=Summaries;BaseClassFlow;true;ReturnParam;(System.Object);;Argument[0];ReturnValue;taint;df-generated
|
||||
// summary=Models;BaseClassFlow;true;ReturnParam;(System.Object);;Argument[0];ReturnValue;taint;df-generated
|
||||
public virtual object ReturnParam(object input)
|
||||
{
|
||||
return input;
|
||||
@@ -214,7 +236,7 @@ public abstract class BaseClassFlow
|
||||
|
||||
public class DerivedClass1Flow : BaseClassFlow
|
||||
{
|
||||
// summary=Summaries;DerivedClass1Flow;false;ReturnParam1;(System.String,System.String);;Argument[1];ReturnValue;taint;df-generated
|
||||
// summary=Models;DerivedClass1Flow;false;ReturnParam1;(System.String,System.String);;Argument[1];ReturnValue;taint;df-generated
|
||||
public string ReturnParam1(string input0, string input1)
|
||||
{
|
||||
return input1;
|
||||
@@ -223,13 +245,13 @@ public class DerivedClass1Flow : BaseClassFlow
|
||||
|
||||
public class DerivedClass2Flow : BaseClassFlow
|
||||
{
|
||||
// summary=Summaries;DerivedClass2Flow;false;ReturnParam;(System.Object);;Argument[0];ReturnValue;taint;df-generated
|
||||
// summary=Models;DerivedClass2Flow;false;ReturnParam;(System.Object);;Argument[0];ReturnValue;taint;df-generated
|
||||
public override object ReturnParam(object input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
// summary=Summaries;DerivedClass2Flow;false;ReturnParam0;(System.String,System.Int32);;Argument[0];ReturnValue;taint;df-generated
|
||||
// summary=Models;DerivedClass2Flow;false;ReturnParam0;(System.String,System.Int32);;Argument[0];ReturnValue;taint;df-generated
|
||||
public string ReturnParam0(string input0, int input1)
|
||||
{
|
||||
return input0;
|
||||
@@ -240,33 +262,35 @@ public class OperatorFlow
|
||||
{
|
||||
public readonly object Field;
|
||||
|
||||
// summary=Summaries;OperatorFlow;false;OperatorFlow;(System.Object);;Argument[0];Argument[this];taint;df-generated
|
||||
// summary=Models;OperatorFlow;false;OperatorFlow;(System.Object);;Argument[0];Argument[this];taint;df-generated
|
||||
public OperatorFlow(object o)
|
||||
{
|
||||
Field = o;
|
||||
}
|
||||
|
||||
// Flow Summary.
|
||||
// summary=Summaries;OperatorFlow;false;op_Addition;(Summaries.OperatorFlow,Summaries.OperatorFlow);;Argument[0];ReturnValue;taint;df-generated
|
||||
// summary=Models;OperatorFlow;false;op_Addition;(Models.OperatorFlow,Models.OperatorFlow);;Argument[0];ReturnValue;taint;df-generated
|
||||
public static OperatorFlow operator +(OperatorFlow a, OperatorFlow b)
|
||||
{
|
||||
return a;
|
||||
}
|
||||
|
||||
// No flow summary.
|
||||
// neutral=Summaries;OperatorFlow;op_Increment;(Summaries.OperatorFlow);summary;df-generated
|
||||
// neutral=Models;OperatorFlow;op_Increment;(Models.OperatorFlow);summary;df-generated
|
||||
public static OperatorFlow operator ++(OperatorFlow a)
|
||||
{
|
||||
return new OperatorFlow(new object());
|
||||
}
|
||||
|
||||
// No flow summary as this is an implicit conversion operator.
|
||||
// No model as user defined conversion operators are excluded
|
||||
// from model generation.
|
||||
public static implicit operator OperatorFlow(string s)
|
||||
{
|
||||
return new OperatorFlow(s);
|
||||
}
|
||||
|
||||
// No flow summary as this is an explicit conversion operator.
|
||||
// No model as user defined conversion operators are excluded
|
||||
// from model generation.
|
||||
public static explicit operator OperatorFlow(string[] b)
|
||||
{
|
||||
return new OperatorFlow(b);
|
||||
@@ -279,22 +303,19 @@ public class EqualsGetHashCodeNoFlow
|
||||
public readonly bool boolTainted;
|
||||
public readonly int intTainted;
|
||||
|
||||
// No flow summary as this is an override of the Equals method.
|
||||
// neutral=Summaries;EqualsGetHashCodeNoFlow;Equals;(System.Object);summary;df-generated
|
||||
// neutral=Models;EqualsGetHashCodeNoFlow;Equals;(System.Object);summary;df-generated
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return boolTainted;
|
||||
}
|
||||
|
||||
// Flow summary as this is not an override of the object Equals method.
|
||||
// summary=Summaries;EqualsGetHashCodeNoFlow;false;Equals;(System.String);;Argument[0];ReturnValue;taint;df-generated
|
||||
// summary=Models;EqualsGetHashCodeNoFlow;false;Equals;(System.String);;Argument[0];ReturnValue;taint;df-generated
|
||||
public string Equals(string s)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
// No flow summary as this is an override of the GetHashCode method.
|
||||
// neutral=Summaries;EqualsGetHashCodeNoFlow;GetHashCode;();summary;df-generated
|
||||
// neutral=Models;EqualsGetHashCodeNoFlow;GetHashCode;();summary;df-generated
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return intTainted;
|
||||
@@ -305,15 +326,167 @@ public class Properties
|
||||
{
|
||||
private string tainted;
|
||||
|
||||
// summary=Summaries;Properties;false;get_Prop1;();;Argument[this];ReturnValue;taint;df-generated
|
||||
// summary=Models;Properties;false;get_Prop1;();;Argument[this];ReturnValue;taint;df-generated
|
||||
public string Prop1
|
||||
{
|
||||
get { return tainted; }
|
||||
}
|
||||
|
||||
// summary=Summaries;Properties;false;set_Prop2;(System.String);;Argument[0];Argument[this];taint;df-generated
|
||||
// summary=Models;Properties;false;set_Prop2;(System.String);;Argument[0];Argument[this];taint;df-generated
|
||||
public string Prop2
|
||||
{
|
||||
set { tainted = value; }
|
||||
}
|
||||
|
||||
public object backingField;
|
||||
// No model as properties with public getters and setters are excluded from
|
||||
// model generation as these are handled directly by the dataflow library.
|
||||
public object Prop
|
||||
{
|
||||
get { return backingField; }
|
||||
set { backingField = value; }
|
||||
}
|
||||
}
|
||||
|
||||
// No models as the methods are not public.
|
||||
public sealed class PublicClassNoFlow
|
||||
{
|
||||
private object PrivateReturn(object input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
internal object InternalReturn(object input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
private class PrivateClassNoFlow
|
||||
{
|
||||
public object ReturnParam(object input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
private class PrivateClassNestedPublicClassNoFlow
|
||||
{
|
||||
public class NestedPublicClassFlow
|
||||
{
|
||||
public object ReturnParam(object input)
|
||||
{
|
||||
return input;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class EquatableBound : IEquatable<object>
|
||||
{
|
||||
public readonly bool tainted;
|
||||
|
||||
// neutral=Models;EquatableBound;Equals;(System.Object);summary;df-generated
|
||||
public bool Equals(object other)
|
||||
{
|
||||
return tainted;
|
||||
}
|
||||
}
|
||||
|
||||
public class EquatableUnBound<T> : IEquatable<T>
|
||||
{
|
||||
public readonly bool tainted;
|
||||
|
||||
// neutral=Models;EquatableUnBound<T>;Equals;(T);summary;df-generated
|
||||
public bool Equals(T? other)
|
||||
{
|
||||
return tainted;
|
||||
}
|
||||
}
|
||||
|
||||
// No methods in this class will have generated flow summaries as
|
||||
// simple types are used.
|
||||
public class SimpleTypes
|
||||
{
|
||||
// neutral=Models;SimpleTypes;M1;(System.Boolean);summary;df-generated
|
||||
public bool M1(bool b)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
// neutral=Models;SimpleTypes;M2;(System.Boolean);summary;df-generated
|
||||
public Boolean M2(Boolean b)
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
// neutral=Models;SimpleTypes;M3;(System.Int32);summary;df-generated
|
||||
public int M3(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
// neutral=Models;SimpleTypes;M4;(System.Int32);summary;df-generated
|
||||
public Int32 M4(Int32 i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// No models as higher order methods are excluded
|
||||
// from model generation.
|
||||
public class HigherOrderParameters
|
||||
{
|
||||
public string M1(string s, Func<string, string> map)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
public object M2(Func<object, object> map, object o)
|
||||
{
|
||||
return map(o);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class BaseClass
|
||||
{
|
||||
// neutral=Models;BaseClass;M1;(System.String);summary;df-generated
|
||||
public virtual string M1(string s)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
// neutral=Models;BaseClass;M2;(System.String);summary;df-generated
|
||||
public abstract string M2(string s);
|
||||
}
|
||||
|
||||
// No models as manually modelled methods are excluded from
|
||||
// model generation.
|
||||
public class ManuallyModelled
|
||||
{
|
||||
public object HasSummary(object o)
|
||||
{
|
||||
return o;
|
||||
}
|
||||
|
||||
public object HasNeutralSummary(object o)
|
||||
{
|
||||
return o;
|
||||
}
|
||||
|
||||
public object HasNeutralSummaryNoFlow(object o)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class ParameterlessConstructor
|
||||
{
|
||||
public bool IsInitialized;
|
||||
|
||||
// No model as parameterless constructors
|
||||
// are excluded from model generation.
|
||||
public ParameterlessConstructor()
|
||||
{
|
||||
IsInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user