Class AbstractXMLSourceSinkParser
java.lang.Object
soot.jimple.infoflow.android.source.parsers.xml.AbstractXMLSourceSinkParser
- Direct Known Subclasses:
XMLSourceSinkParser
Abstract class for all Flowdroid XML parsers. Returns a Set of Methods when
calling the function parse. Subclasses may implement parser specifics to
different language engines.
- Author:
- Anna-Katharina Wickert, Joern Tillmans, Steven Arzt, Niklas Vogel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFilter interface for excluding certain categories from the source/sink set.protected classHandler class for the XML parser -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<ISourceSinkCategory,ISourceSinkCategory> protected Set<ISourceSinkDefinition>protected Set<ISourceSinkDefinition>protected soot.util.MultiMap<String,ISourceSinkDefinition> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddSourceSinkDefinition(String signature, IAccessPathBasedSourceSinkDefinition ssd) Adds a new source or sink definitionprotected voidaddSourceSinkDefinition(String signature, ISourceSinkDefinition ssd) protected abstract voidBuilds the lists of sources and sinks from the data that we have parsedprotected abstract ISourceSinkDefinitioncreateFieldSourceSinkDefinition(String signature, Set<AccessPathTuple> baseAPs) Factory method forFieldSourceSinkDefinitioninstancesprotected abstract ISourceSinkDefinitioncreateFieldSourceSinkDefinition(String signature, Set<AccessPathTuple> baseAPs, Set<SourceSinkCondition> conditions) Factory method forFieldSourceSinkDefinitioninstancesprotected abstract ISourceSinkDefinitioncreateMethodSourceSinkDefinition(AbstractMethodAndClass method, Set<AccessPathTuple> baseAPs, Set<AccessPathTuple>[] paramAPs, Set<AccessPathTuple> returnAPs, MethodSourceSinkDefinition.CallType callType, ISourceSinkCategory category) Factory method forMethodSourceSinkDefinitioninstancesprotected abstract ISourceSinkDefinitioncreateMethodSourceSinkDefinition(AbstractMethodAndClass method, Set<AccessPathTuple> baseAPs, Set<AccessPathTuple>[] paramAPs, Set<AccessPathTuple> returnAPs, MethodSourceSinkDefinition.CallType callType, ISourceSinkCategory category, Set<SourceSinkCondition> conditions) Factory method forMethodSourceSinkDefinitioninstancesgetSinks()protected static InputStreamprotected voidparseInputStream(InputStream stream) Parses the given input stream to obtain the source/sink definitionsprotected StringparseSignature(Attributes attributes) Reads the method or field signature from the given attribute mapprotected abstract voidrunParse(SAXParser parser, InputStream stream) Runs the parse method on the given parser
-
Field Details
-
sourcesAndSinks
-
sources
-
sinks
-
categoryFilter
-
categories
-
-
Constructor Details
-
AbstractXMLSourceSinkParser
public AbstractXMLSourceSinkParser()
-
-
Method Details
-
parseInputStream
Parses the given input stream to obtain the source/sink definitions- Parameters:
stream- The stream whose data to parse
-
buildSourceSinkLists
protected abstract void buildSourceSinkLists()Builds the lists of sources and sinks from the data that we have parsed -
runParse
Runs the parse method on the given parser- Parameters:
parser- Parser to run parse onstream- Input stream of XML file
-
addSourceSinkDefinition
Adds a new source or sink definition- Parameters:
signature- The signature of the method or field that is considered a source or a sinkssd- The source or sink definition
-
getSources
-
getSinks
-
getStream
- Throws:
IOException
-
getAllMethods
-
addSourceSinkDefinition
-
createFieldSourceSinkDefinition
protected abstract ISourceSinkDefinition createFieldSourceSinkDefinition(String signature, Set<AccessPathTuple> baseAPs) Factory method forFieldSourceSinkDefinitioninstances- Parameters:
signature- The signature of the target fieldbaseAPs- The access paths that shall be considered as sources or sinks- Returns:
- The newly created
FieldSourceSinkDefinitioninstance
-
createFieldSourceSinkDefinition
protected abstract ISourceSinkDefinition createFieldSourceSinkDefinition(String signature, Set<AccessPathTuple> baseAPs, Set<SourceSinkCondition> conditions) Factory method forFieldSourceSinkDefinitioninstances- Parameters:
signature- The signature of the target fieldbaseAPs- The access paths that shall be considered as sources or sinksconditions- Conditions which has to be true for the definition to be valid- Returns:
- The newly created
FieldSourceSinkDefinitioninstance
-
createMethodSourceSinkDefinition
protected abstract ISourceSinkDefinition createMethodSourceSinkDefinition(AbstractMethodAndClass method, Set<AccessPathTuple> baseAPs, Set<AccessPathTuple>[] paramAPs, Set<AccessPathTuple> returnAPs, MethodSourceSinkDefinition.CallType callType, ISourceSinkCategory category) Factory method forMethodSourceSinkDefinitioninstances- Parameters:
method- The method that is to be defined as a source or sinkbaseAPs- The access paths rooted in the base object that shall be considered as sources or sinksparamAPs- The access paths rooted in parameters that shall be considered as sources or sinks. The index in the set corresponds to the index of the formal parameter to which the respective set of access paths belongs.returnAPs- The access paths rooted in the return object that shall be considered as sources or sinkscallType- The type of call (normal call, callback, etc.)- Returns:
- The newly created
MethodSourceSinkDefinitioninstance
-
createMethodSourceSinkDefinition
protected abstract ISourceSinkDefinition createMethodSourceSinkDefinition(AbstractMethodAndClass method, Set<AccessPathTuple> baseAPs, Set<AccessPathTuple>[] paramAPs, Set<AccessPathTuple> returnAPs, MethodSourceSinkDefinition.CallType callType, ISourceSinkCategory category, Set<SourceSinkCondition> conditions) Factory method forMethodSourceSinkDefinitioninstances- Parameters:
method- The method that is to be defined as a source or sinkbaseAPs- The access paths rooted in the base object that shall be considered as sources or sinksparamAPs- The access paths rooted in parameters that shall be considered as sources or sinks. The index in the set corresponds to the index of the formal parameter to which the respective set of access paths belongs.returnAPs- The access paths rooted in the return object that shall be considered as sources or sinkscallType- The type of call (normal call, callback, etc.)conditions- Conditions which has to be true for the definition to be valid- Returns:
- The newly created
MethodSourceSinkDefinitioninstance
-
parseSignature
Reads the method or field signature from the given attribute map- Parameters:
attributes- The attribute map from which to read the signature- Returns:
- The signature that identifies a Soot method or field
-