rspec/rules/S3374/xml/rule.adoc

102 lines
2.9 KiB
Plaintext
Raw Normal View History

Having two form validation entries with the same name indicates a configuration
issue. Only one of the two configurations will be applied, which can lead to
validation gaps.
== Why is this an issue?
In Struts, form validation is used to validate the data the application's
clients provide as part of a form submission to the server. Configuring two
different form validations with the same name leads to unexpected behaviors.
When faced with multiple form validations with the same name, Struts will
arbitrarily choose one and apply it while discarding the others.
=== What is the potential impact?
2021-04-28 16:49:39 +02:00
The application might perform an incomplete validation of user-submitted forms.
Some parts of the validation configuration defined in discarded items will not
apply, which can have severe consequences if not duplicated in the applied one.
2021-04-28 16:49:39 +02:00
Missing input validation can make the application vulnerable to injection
attacks or other severe issues. They might affect the confidentiality,
integrity, or availability of the application or the data it stores.
2021-04-28 16:49:39 +02:00
== How to fix it
2021-04-28 16:49:39 +02:00
=== Code examples
==== Noncompliant code example
2021-04-28 16:49:39 +02:00
[source,xml,diff-id=1,diff-type=noncompliant]
2021-04-28 16:49:39 +02:00
----
<form-validation>
<formset>
<form name="BookForm"> ... </form>
<form name="BookForm"> ... </form> <!-- Noncompliant -->
</formset>
</form-validation>
----
==== Compliant solution
2021-04-28 16:49:39 +02:00
[source,xml,diff-id=1,diff-type=compliant]
2021-04-28 16:49:39 +02:00
----
<form-validation>
<formset>
<form name="BookForm"> ... </form>
</formset>
</form-validation>
----
=== How does this work?
Only one validation configuration should remain. Depending on what was
previously configured, one should either remove the useless validation entries
or merge all of them into a single complete one.
== Resources
2021-04-28 16:49:39 +02:00
=== Standards
* CWE - https://cwe.mitre.org/data/definitions/102[CWE-102 - Struts: Duplicate Validation Forms]
=== Documentation
* Struts Documentation - https://svn.apache.org/repos/asf/struts/struts1/tags/STRUTS_1_1_B1/contrib/validator/docs/overview.html[Struts Validator]
* OWASP - https://owasp.org/www-community/vulnerabilities/Improper_Data_Validation[Improper Data Validation]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Rename this form; line x holds another form declaration with the same name.
=== Highlighting
* primary: second instance of form name
* secondary: original instance of form name
** message: original
'''
== Comments And Links
(visible only on this page)
=== on 12 Oct 2015, 14:49:34 Ann Campbell wrote:
in ``++validation.xml++``
=== on 19 Mar 2018, 11:04:46 Sébastien GIORIA - AppSecFR wrote:
According to [CWE-102], is a member of A1:2017 Injection.
=== on 29 May 2018, 17:07:01 Alexandre Gigleux wrote:
\[~SPoint] CWE-102 is saying "OWASP Top Ten 2004 Category A1 - Unvalidated Input" and there is no longer a category for "Unvalidated Input".
endif::env-github,rspecator-view[]