Struts: Unused Validation Form

Draft Variant
Structure: Simple
Description

An unused validation form indicates that validation logic is not up-to-date.

Extended Description

It is easy for developers to forget to update validation logic when they remove or rename action form mappings. One indication that validation logic is not being properly maintained is the presence of an unused validation form.

Common Consequences 1
Scope: Other

Impact: Quality Degradation

Potential Mitigations 1
Phase: Implementation
Remove the unused Validation Form from the validation.xml file.
Demonstrative Examples 1
In the following example the class RegistrationForm is a Struts framework ActionForm Bean that will maintain user input data from a registration webpage for an online business site. The user will enter registration data and, through the Struts framework, the RegistrationForm bean will maintain the user data in the form fields using the private member variables. The RegistrationForm class uses the Struts validation capability by extending the ValidatorForm class and including the validation for the form fields within the validator XML file, validator.xml.

Code Example:

Bad
Java
java

// private variables for registration form* private String name; private String address; private String city; private String state; private String zipcode;

java
java

Code Example:

Bad
XML
xml
However, the validator XML file, validator.xml, for the RegistrationForm class includes the validation form for the user input form field "phone" that is no longer used by the input form and the RegistrationForm class. Any validation forms that are no longer required should be removed from the validator XML file, validator.xml.
The existence of unused forms may be an indication to attackers that this code is out of date or poorly maintained.
References 1
Seven Pernicious Kingdoms: A Taxonomy of Software Security Errors
Katrina Tsipenyuk, Brian Chess, and Gary McGraw
NIST Workshop on Software Security Assurance Tools Techniques and MetricsNIST
07-11-2005
ID: REF-6
Applicable Platforms
Languages:
Java : Undetermined
Modes of Introduction
Implementation
Operation
Related Weaknesses
Taxonomy Mapping
  • 7 Pernicious Kingdoms