---
title: "CWE-107: Struts: Unused Validation Form"
url: https://radicalnotion.ai/cwe/cwe-107
type: cwe
description: "An unused validation form indicates that validation logic is not up-to-date."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-107: Struts: Unused Validation Form

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 0
- **Of those, in CISA KEV:** 0
- **New in 2026:** 0
- **CWE catalog version:** 4.21

## Description

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

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | 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. |
| Operation | - |

## Applicable platforms

**Languages:** Java (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Other | Quality Degradation | - |

## Potential mitigations

### Implementation

Remove the unused Validation Form from the validation.xml file.

## Detection methods

### Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

## Demonstrative examples

### Example 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.

Bad code:

```java
public class RegistrationForm extends org.apache.struts.validator.ValidatorForm {

    // private variables for registration form
    private String name;
    private String address;
    private String city;
    private String state;
    private String zipcode;
    // no longer using the phone form field

    // private String phone;
    private String email;

    public RegistrationForm() {
        super();
    }

    // getter and setter methods for private variables
    ...
}
```

Bad code:

```xml
<form-validation>
    <formset>
        <form name="RegistrationForm">
            <field property="name" depends="required">
                <arg position="0" key="prompt.name"/>
            </field>
            <field property="address" depends="required">
                <arg position="0" key="prompt.address"/>
            </field>
            <field property="city" depends="required">
                <arg position="0" key="prompt.city"/>
            </field>
            <field property="state" depends="required,mask">
                <arg position="0" key="prompt.state"/>
                <var>
                    <var-name>mask</var-name>
                    <var-value>[a-zA-Z]{2}</var-value>
                </var>
            </field>
            <field property="zipcode" depends="required,mask">
                <arg position="0" key="prompt.zipcode"/>
                <var>
                    <var-name>mask</var-name>
                    <var-value>\d{5}</var-value>
                </var>
            </field>
            <field property="phone" depends="required,mask">
                <arg position="0" key="prompt.phone"/>
                <var>
                    <var-name>mask</var-name>
                    <var-value>^([0-9]{3})(-)([0-9]{4}|[0-9]{4})$</var-value>
                </var>
            </field>
            <field property="email" depends="required,email">
                <arg position="0" key="prompt.email"/>
            </field>
        </form>
    </formset>
</form-validation>
```

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-20](https://radicalnotion.ai/cwe/cwe-20) | Improper Input Validation |
| Parent | [CWE-561](https://radicalnotion.ai/cwe/cwe-561) | Dead Code |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| 7 Pernicious Kingdoms | Struts: Unused Validation Form | - | - |

## Frequently asked questions

### What is CWE-107?

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

### How do you prevent CWE-107?

Remove the unused Validation Form from the validation.xml file.

### How is CWE-107 detected?

Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

### What are the consequences of CWE-107?

Exploiting CWE-107 can lead to: Quality Degradation.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/107.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-107). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
