for( SecurityCheckedParameter parameter : getParameterHolder().getParameterList() )
{
if( parameter.isChecked() )
{
TestProperty property = getTestStep().getProperties().get( parameter.getName() );
// no xpath, just put invalid type value in parameter value
if( parameter.getXpath() == null || parameter.getXpath().trim().length() == 0 )
{
for( SchemaTypeForSecurityScanConfig invalidType : invalidTypeConfig.getTypesListList() )
{
if( !parameterMutations.containsKey( parameter ) )
parameterMutations.put( parameter, new ArrayList<String>() );
parameterMutations.get( parameter ).add( invalidType.getValue() );
}
}
else
{
// we have xpath but do we have xml which need to mutate
// ignore if there is no value, since than we'll get exception
if( property.getValue() == null && property.getDefaultValue() == null )
continue;
// get value of that property
String value = context.expand( property.getValue() );
if( XmlUtils.seemsToBeXml( value ) )
{
// XmlObjectTreeModel model = new XmlObjectTreeModel(
// property.getSchemaType().getTypeSystem(),
// XmlObject.Factory.parse( value ) );
XmlObjectTreeModel model = new XmlObjectTreeModel( property.getSchemaType().getTypeSystem(),
XmlUtils.createXmlObject( value ) );
XmlTreeNode[] nodes = model.selectTreeNodes( context.expand( parameter.getXpath() ) );
// for each invalid type set all nodes