F4FActions
java.lang.Object
extended by com.ibm.appscan.frameworks.highlevelapi.F4FActions
public class F4FActions
extends java.lang.Object
Class for specifying how the application's framework constructs
should be modeled. An F4FHandler
mutates the F4FAction
object
passed to F4FHandler.handleApp(F4FApp, F4FActions)
as
it analyzes the application.
Constructor Detail
F4FActions
public F4FActions()
Create an empty F4FActions
object.
Should not be needed for implementing a new framework handler, as
the relevant F4FActions
object will be passed to F4FHandler.handleApp(F4FApp,
F4FActions)
.
addTaintedCallback
public void addTaintedCallback(IMethod method,
int numParams)
Same as addTaintedCallback (String,
int)
, but takes an IMethod
directly rather
than a VDB signature
addTaintedCallback
public void addTaintedCallback(java.lang.String vdbMethodSig,
int numParams)
Make a method a tainted callback, with all parameters tainted.
int
as
a parameter type, we need System.Int32
, etc. To see
the full mapping from fully-qualified names to the names usually used
in VDB, see DotNetVDBUtil.systemName2VDBShortName
.Parameters:
vdbMethodSig
- the signature of thecallback
methodnumParams
- the number of parameters for thecallback
method, including thethis
parameter
replaceCalls
public void replaceCalls(java.lang.String oldVDBSig,
java.lang.String newVDBSig)
Replace all calls to one method with calls to another method. We require that the descriptors for the old and new method (i.e., the number of arguments, argument type, and return type) are identical.
oldVDBSig
is the _declared_
target at a call site. So, if oldVDBSig
is Integer.toString()
,
and we see a call to Object.toString()
, we will _not_
perform a replacement at that call site, even though it might invoke Integer.toString()
.int
as
a parameter type, we need System.Int32
, etc. To see
the full mapping from fully-qualified names to the names usually used
in VDB, see DotNetVDBUtil.systemName2VDBShortName
Parameters:
oldVDBSig
- signature of method whose calls should be replacednewVDBSig
- signature of method to replace calls with
replaceCallsWithSyntheticExpr
public void replaceCallsWithSyntheticExpr(java.lang.String vdbSig,
com.ibm.appscan.frameworks.specinfo.SyntheticExpr expr)
Replace
all calls to a method with an arbitrary WAFL SyntheticExpr
.
For example, one could replace calls with an assignment via an AssignmentExpr
.
oldVDBSig
is the _declared_
target at a call site. So, if oldVDBSig
is Integer.toString()
,
and we see a call to Object.toString()
, we will _not_
perform a replacement at that call site, even though it might invoke Integer.toString()
.int
as
a parameter type, we need System.Int32
, etc. To see
the full mapping from fully-qualified names to the names usually used
in VDB, see DotNetVDBUtil.systemName2VDBShortName
Parameters:
vdbSig
- signature of method whose calls should be replacedexpr
- synthetic expression to replace calls with
replaceCallsWithParamPattern
public void replaceCallsWithParamPattern(java.lang.String oldVDBSig,
java.util.Map<java.lang.String,
java.util.Map<java.lang.Integer,
java.util.regex.Pattern>>
newSig2Pattern)
Replace
calls to one method with calls to another method only if the parameters
of String
type are constants meeting specified patterns.
We require that the descriptors for the old and new method (i.e.,
the number of arguments, argument type, and return type) are identical.
oldVDBSig
is the _declared_
target at a call site. So, if oldVDBSig
is Integer.toString()
,
and we see a call to Object.toString()
, we will _not_
perform a replacement at that call site, even though it might invoke Integer.toString()
.int
as
a parameter type, we need System.Int32
, etc. To see
the full mapping from fully-qualified names to the names usually used
in VDB, see DotNetVDBUtil.systemName2VDBShortName
Parameters:
oldVDBSig
- signature of method whose calls should be replacednewSig2Pattern
- maps VDB signature of each possible replacement methodm
to a mapM
from integer parameter positions toPatterns
. If the string constant parameters in the appropriate positions match the patterns inM
at some call site, a replacement tom
will be performed.
addFrameworkInfo
public void addFrameworkInfo
(com.ibm.appscan.frameworks.specinfo.IFrameworkInfo info)
Add arbitrary additional framework info. This method should only be needed for rare cases where the other APIs provided are insufficient.
addTaintedCallback
public void addTaintedCallback(java.lang.String vdbMethodSig,
java.util.Collection<TaintedParam>
taintedParams)
Make some method a tainted callback, with only certain parameter access paths being treated as tainted.
int
as a parameter
type, we need System.Int32
, etc. To see the full
mapping from fully-qualified names to the names usually used in VDB,
see DotNetVDBUtil.systemName2VDBShortName
Parameters:
vdbMethodSig
- the signature of the callback method, in VDB formattaintedParams
- information on which parameter access paths should be tainted
addHighLevelSyntheticMethod
public void addHighLevelSyntheticMethod(HighLevelSyntheticMethod m)
equivalent
to addHighLevelSyntheticMethod(m, true)
addHighLevelSyntheticMethod
public void addHighLevelSyntheticMethod(HighLevelSyntheticMethod m,
boolean isEntrypoint)
Add a high-level synthetic method. A corresponding WAFL synthetic method (possibly an entrypoint) will be generated.
Parameters:
m
- the methodisEntrypoint
- should the method be marked as an entrypoint in WAFL?
createGlobal
public Global createGlobal(java.lang.String name,
java.lang.String declaredVDBType,
boolean isEntrypointScoped)
Create
a new global that can be accessed from HighLevelSyntheticMethods
.
Parameters:
name
- name for the globaldeclaredVDBType
- the declared type of the global (e.g.,java.lang.String
).Note: for .NET apps, we need a fully-qualified VDB type. So, instead ofint
as a parameter type, we needSystem.Int32
, etc. To see the full mapping from fully-qualified names to the names usually used in VDB, seeDotNetVDBUtil.systemName2VDBShortName
isEntrypointScoped
- if true, the global is scoped to a single entrypoint (i.e., it is request-scoped). Otherwise, the global is scoped across entrypoints (i.e., it is "session" or "application" scoped)
Returns:
- a Global object, which can be read/written inside a
HighLevelSyntheticMethod
createGlobal
public Global createGlobal(java.lang.String name,
IClass declaredClass,
boolean isEntrypointScoped)
Just like createGlobal(String,
String, boolean)
, but takes an IClass
for
the declared type instead of a type name
getGlobals
public java.util.Collection<Global> getGlobals()
For internal usage.
getAdditionalFrameworkInfo
public java.util.Collection
<com.ibm.appscan.frameworks.specinfo.IFrameworkInfo>
getAdditionalFrameworkInfo()
For internal usage.
getCallReplacement2SigsInfo
public java.util.Map
<java.lang.String,java.util.Map
<java.lang.String,java.util.Map
<java.lang.Integer,java.util.regex.Pattern>>>
getCallReplacement2SigsInfo()
For internal usage.
getCallReplacement2ExprInfo
public java.util.Map
<java.lang.String,com.ibm.appscan.frameworks.specinfo.SyntheticExpr>
getCallReplacement2ExprInfo()
For internal usage.
getCallback2TaintedParams
public java.util.Map
<java.lang.String,java.util.Collection<TaintedParam>>
getCallback2TaintedParams()
For internal usage.
getHighLevelSyntheticMethods
public java.util.List
<com.ibm.wala.util.collections.Pair
<HighLevelSyntheticMethod,java.lang.Boolean>>
getHighLevelSyntheticMethods()
For internal usage.
toString
public java.lang.String toString()
Overrides:
toString
in classjava.lang.Object