Class MethodSourceSinkDefinition
java.lang.Object
soot.jimple.infoflow.sourcesSinks.definitions.AbstractSourceSinkDefinition
soot.jimple.infoflow.sourcesSinks.definitions.MethodSourceSinkDefinition
- All Implemented Interfaces:
IAccessPathBasedSourceSinkDefinition,ISourceSinkDefinition
public class MethodSourceSinkDefinition
extends AbstractSourceSinkDefinition
implements IAccessPathBasedSourceSinkDefinition
A class to handle all access paths of sources and sinks for a certain method.
- Author:
- Daniel Magin, Steven Arzt
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration containing the different types of method invocations that can be defined as sources or sinks -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Set<AccessPathTuple>protected final MethodSourceSinkDefinition.CallTypeprotected final SootMethodAndClassprotected Set<AccessPathTuple>[]protected Set<AccessPathTuple>Fields inherited from class soot.jimple.infoflow.sourcesSinks.definitions.AbstractSourceSinkDefinition
category, conditions -
Constructor Summary
ConstructorsConstructorDescriptionMethodSourceSinkDefinition(Set<AccessPathTuple> baseObjects, Set<AccessPathTuple>[] parameters, Set<AccessPathTuple> returnValues, MethodSourceSinkDefinition.CallType callType) Creates a new instance of theMethodSourceSinkDefinitionclass without a method.Creates a new instance of theMethodSourceSinkDefinitionclassMethodSourceSinkDefinition(SootMethodAndClass am, Set<AccessPathTuple> baseObjects, Set<AccessPathTuple>[] parameters, Set<AccessPathTuple> returnValues, MethodSourceSinkDefinition.CallType callType) Creates a new instance of the MethodSourceSinkDefinition classMethodSourceSinkDefinition(SootMethodAndClass am, Set<AccessPathTuple> baseObjects, Set<AccessPathTuple>[] parameters, Set<AccessPathTuple> returnValues, MethodSourceSinkDefinition.CallType callType, ISourceSinkCategory category) Creates a new instance of the MethodSourceSinkDefinition classCreates a new instance of theMethodSourceSinkDefinitionclass -
Method Summary
Modifier and TypeMethodDescriptionvoidaddParameterDefinition(int paramIdx, Set<AccessPathTuple> paramDefs) Adds the given access path tuples to this source/sink definition for the given parameter indexprotected MethodSourceSinkDefinitionbuildNewDefinition(Set<AccessPathTuple> baseAPTs, Set<AccessPathTuple>[] paramAPTs, Set<AccessPathTuple> returnAPTs) Factory method for creating a new method-based source/sink definition based on the current one.protected MethodSourceSinkDefinitionbuildNewDefinition(SootMethodAndClass methodAndclass, Set<AccessPathTuple> filteredBaseObjects, Set<AccessPathTuple>[] filteredParameters, Set<AccessPathTuple> filteredReturnValues, MethodSourceSinkDefinition.CallType callType) static MethodSourceSinkDefinitioncreateParameterSource(int index, MethodSourceSinkDefinition.CallType callType) Creates a source definition that considers a parameter as taintedstatic MethodSourceSinkDefinitionCreates a source definition that considers the return value as taintedbooleanfilter(Collection<AccessPathTuple> accessPaths) Filters the source/sink definition to only reference the given access pathsGets all access paths referenced in this source or sink definition, regardless of their respective semanticsintGets the number of access paths defined as sources or sinks on base objectsGets the source and sink definitions for the base object on which a method of this class is invokedGets the shared sink definition that is not associated with any method and taints the base objectGets the shared source definition that is not associated with any method and taints the base objectGets the type of method invocations that are denoted by this source or sinkGets the method for which this object defines sources and sinksintGets the number of access paths defined as sources or sinks on parametersGets the source and sink definitions for parameters of the current methodintGets the number of access paths defined as sources or sinks on return valuesGets the source definitions for the return value of the current methodCreates a definition which is a subset of this definition that only contains the sinksCreates a definition which is a subset of this definition that only contains the sourcesinthashCode()booleanisEmpty()Checks whether this source/sink definition is empty, i.e., has no concrete access pathssimplify()Checks whether this definition is equivalent to one of the simple predefined ones.toString()Methods inherited from class soot.jimple.infoflow.sourcesSinks.definitions.AbstractSourceSinkDefinition
getCategory, getConditions, setCategory, setConditionsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface soot.jimple.infoflow.sourcesSinks.definitions.ISourceSinkDefinition
getCategory, getConditions, setCategory, setConditions
-
Field Details
-
method
-
callType
-
baseObjects
-
parameters
-
returnValues
-
-
Constructor Details
-
MethodSourceSinkDefinition
public MethodSourceSinkDefinition(Set<AccessPathTuple> baseObjects, Set<AccessPathTuple>[] parameters, Set<AccessPathTuple> returnValues, MethodSourceSinkDefinition.CallType callType) Creates a new instance of theMethodSourceSinkDefinitionclass without a method. This constructor is intended to be used for sources that arise from UI elements or other programming constructs that are not directly associated with a single method being called. -
MethodSourceSinkDefinition
Creates a new instance of theMethodSourceSinkDefinitionclass- Parameters:
am- The method for which this object defines sources and sinks
-
MethodSourceSinkDefinition
public MethodSourceSinkDefinition(SootMethodAndClass am, MethodSourceSinkDefinition.CallType callType) Creates a new instance of theMethodSourceSinkDefinitionclass- Parameters:
am- The method for which this object defines sources and sinkscallType- The type of calls to define as sources or sinks
-
MethodSourceSinkDefinition
public MethodSourceSinkDefinition(SootMethodAndClass am, Set<AccessPathTuple> baseObjects, Set<AccessPathTuple>[] parameters, Set<AccessPathTuple> returnValues, MethodSourceSinkDefinition.CallType callType) Creates a new instance of the MethodSourceSinkDefinition class- Parameters:
am- The method for which this object defines sources and sinksbaseObjects- The source and sink definitions for the base object on which a method of this class is invokedparameters- The source and sink definitions for parameters of the current methodcallType- The type of calls to define as sources or sinksreturnValues- The source definitions for the return value of the current method
-
MethodSourceSinkDefinition
public MethodSourceSinkDefinition(SootMethodAndClass am, Set<AccessPathTuple> baseObjects, Set<AccessPathTuple>[] parameters, Set<AccessPathTuple> returnValues, MethodSourceSinkDefinition.CallType callType, ISourceSinkCategory category) Creates a new instance of the MethodSourceSinkDefinition class- Parameters:
am- The method for which this object defines sources and sinksbaseObjects- The source and sink definitions for the base object on which a method of this class is invokedparameters- The source and sink definitions for parameters of the current methodreturnValues- The source definitions for the return value of the current methodcallType- The type of calls to define as sources or sinkscategory- The category to which this source or sink belongs
-
-
Method Details
-
getMethod
Gets the method for which this object defines sources and sinks- Returns:
- The method for which this object defines sources and sinks
-
getCallType
Gets the type of method invocations that are denoted by this source or sink- Returns:
- The type of method invocations that are denoted by this source or sink
-
getBaseObjects
Gets the source and sink definitions for the base object on which a method of this class is invoked- Returns:
- The source and sink definitions for the base object
-
getBaseObjectCount
public int getBaseObjectCount()Gets the number of access paths defined as sources or sinks on base objects- Returns:
- The number of access paths defined as sources or sinks on base objects
-
getParameters
Gets the source and sink definitions for parameters of the current method- Returns:
- The source and sink definitions for parameters
-
getParameterCount
public int getParameterCount()Gets the number of access paths defined as sources or sinks on parameters- Returns:
- The number of access paths defined as sources or sinks on parameters
-
getReturnValues
Gets the source definitions for the return value of the current method- Returns:
- The source definitions for the return value
-
getReturnValueCount
public int getReturnValueCount()Gets the number of access paths defined as sources or sinks on return values- Returns:
- The number of access paths defined as sources or sinks on return values
-
isEmpty
public boolean isEmpty()Description copied from interface:IAccessPathBasedSourceSinkDefinitionChecks whether this source/sink definition is empty, i.e., has no concrete access paths- Specified by:
isEmptyin interfaceIAccessPathBasedSourceSinkDefinition- Specified by:
isEmptyin interfaceISourceSinkDefinition- Returns:
- True if this source/sink definition is empty, i.e., has no concrete access paths, otherwise false
-
toString
-
getSourceOnlyDefinition
Description copied from interface:IAccessPathBasedSourceSinkDefinitionCreates a definition which is a subset of this definition that only contains the sources- Specified by:
getSourceOnlyDefinitionin interfaceIAccessPathBasedSourceSinkDefinition- Specified by:
getSourceOnlyDefinitionin interfaceISourceSinkDefinition- Returns:
- The source-only subset of this definition
-
getSinkOnlyDefinition
Description copied from interface:IAccessPathBasedSourceSinkDefinitionCreates a definition which is a subset of this definition that only contains the sinks- Specified by:
getSinkOnlyDefinitionin interfaceIAccessPathBasedSourceSinkDefinition- Specified by:
getSinkOnlyDefinitionin interfaceISourceSinkDefinition- Returns:
- The sink-only subset of this definition
-
buildNewDefinition
protected MethodSourceSinkDefinition buildNewDefinition(Set<AccessPathTuple> baseAPTs, Set<AccessPathTuple>[] paramAPTs, Set<AccessPathTuple> returnAPTs) Factory method for creating a new method-based source/sink definition based on the current one. This method is used when transforming the current definition. Derived classes can override this method to create instances of the correct class.- Parameters:
baseAPTs- The access paths rooted in the base objectparamAPTs- The access paths rooted in the method's parametersreturnAPTs- The access paths rooted in the return value- Returns:
- The new source/sink definition object
-
buildNewDefinition
protected MethodSourceSinkDefinition buildNewDefinition(SootMethodAndClass methodAndclass, Set<AccessPathTuple> filteredBaseObjects, Set<AccessPathTuple>[] filteredParameters, Set<AccessPathTuple> filteredReturnValues, MethodSourceSinkDefinition.CallType callType) -
addParameterDefinition
Adds the given access path tuples to this source/sink definition for the given parameter index- Parameters:
paramIdx- The parameter indexparamDefs- The access path tuples
-
getBaseObjectSource
Gets the shared source definition that is not associated with any method and taints the base object- Returns:
- The shared blank source definition that is not associated with any method and taints the base object
-
getBaseObjectSink
Gets the shared sink definition that is not associated with any method and taints the base object- Returns:
- The shared blank sink definition that is not associated with any method and taints the base object
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractSourceSinkDefinition
-
equals
- Overrides:
equalsin classAbstractSourceSinkDefinition
-
createParameterSource
public static MethodSourceSinkDefinition createParameterSource(int index, MethodSourceSinkDefinition.CallType callType) Creates a source definition that considers a parameter as tainted- Parameters:
index- The index of the parameter to consider as taintedcallType- The type of call- Returns:
- The newly created source definition
-
createReturnSource
public static MethodSourceSinkDefinition createReturnSource(MethodSourceSinkDefinition.CallType callType) Creates a source definition that considers the return value as tainted- Parameters:
callType- The type of call- Returns:
- The newly created source definition
-
simplify
Checks whether this definition is equivalent to one of the simple predefined ones. If so, it returns the shared predefined object. Otherwise, it returns this object.- Returns:
- A shared object that is equal to this one if possible, otherwise this object
-
getAllAccessPaths
Description copied from interface:IAccessPathBasedSourceSinkDefinitionGets all access paths referenced in this source or sink definition, regardless of their respective semantics- Specified by:
getAllAccessPathsin interfaceIAccessPathBasedSourceSinkDefinition- Returns:
- All access paths referenced in this source or sink definition. The return value can be null if this definition does not reference any access paths.
-
filter
Description copied from interface:IAccessPathBasedSourceSinkDefinitionFilters the source/sink definition to only reference the given access paths- Specified by:
filterin interfaceIAccessPathBasedSourceSinkDefinition- Parameters:
accessPaths- The access path to which to limit the scope of this source/sink definition- Returns:
- A copy of this source/sink definition that only references the given access paths
-