Validation fields that do not appear in forms they are associated with indicate that the validation logic is out of date.
It is easy for developers to forget to update validation logic when they make changes to an ActionForm
class. One indication that validation logic is not being properly maintained is inconsistencies between the action form and the validation form.
Example 1.a: An action form with two fields.
public class DateRangeForm extends ValidatorForm {
String startDate, endDate;
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
}
startDate
and endDate
.
<form name="DateRangeForm">
<field property="startDate" depends="date">
<arg0 key="start.date"/>
</field>
<field property="endDate" depends="date">
<arg0 key="end.date"/>
</field>
<field property="scale" depends="integer">
<arg0 key="range.scale"/>
</field>
</form>
scale
. The presence of the third field suggests that DateRangeForm
was modified without taking validation into account.[1] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A10 Insecure Configuration Management
[2] Standards Mapping - OWASP Top 10 2010 - (OWASP 2010) A6 Security Misconfiguration
[3] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3510 CAT I
[4] Standards Mapping - FIPS200 - (FISMA) CM
[5] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 110
[6] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 - (PCI 1.1) Requirement 6.5.10
[7] T. Husted et al. Struts in Action: Building Web Applications with the Leading Java Framework Manning Publications
[8] The Struts project The Apache Foundation