Start here

Home
About Klocwork
What's new
Fixed issues
Release notes
Installation

Reference

C/C++ checkers
Java checkers
C# checkers
MISRA C 2004 checkers
MISRA C++ 2008 checkers
MISRA C 2012 checkers
MISRA C 2012 checkers with Amendment 1
Commands
Metrics
Troubleshooting
Reference

Product components

C/C++ Integration build analysis
Java Integration build analysis
Desktop analysis
Refactoring
Klocwork Static Code Analysis
Klocwork Code Review
Structure101
Tuning
Custom checkers

Coding environments

Visual Studio
Eclipse for C/C++
Eclipse for Java
IntelliJ IDEA
Other

Administration

Project configuration
Build configuration
Administration
Analysis performance
Server performance
Security/permissions
Licensing
Klocwork Static Code Analysis Web API
Klocwork Code Review Web API

Community

View help online
Visit RogueWave.com
Klocwork Support
Rogue Wave Videos

Legal

Legal information

SV.STRUTS.NOTRESET

This error appears when a class extends org.apache.struts.action.ActionForm and has a reset method, but it does not reset some fields.

Vulnerability and risk

IReset method is called before filling out a form with request parameters. If some fields are not reset, they can have old values which can be used by an attacker. Since a client request can be easily manipulated by an attacker, do not depend on the presence of certain fields in a request.

Klocwork security vulnerability (SV) checkers identify calls that create potentially dangerous data; these calls are considered unsafe sources. An unsafe source can be any data provided by the user, since the user could be an attacker or has the potential for introducing human error.

Mitigation and prevention

Reset all fields that a client can populate. If a field cannot be populated by the client that usually means the Form tries to implement some business logic or is used as an output form, which normally should not be part of the ActionForm and should be implemented by a different class.

Example 1

13 public class SV_STRUTS_NOTRESET_Sample_1 extends ActionForm {
14     private String name;
15     private String[] cars = new String[10];
16     public String getName() {
17         return name;
18     }
19     public void setName(String name) {
20         this.name = name;
21     }
22     public String getCar(int i) {
23         return cars[i];
24     }
25     public void setCar(int i, String car) {
26         this.cars[i] = car;
27     }
28     public void reset(ActionMapping map,
29                       HttpServletRequest req) {
30         cars = new String[10];
31     }
32 }

SV.STRUTS.NOTRESET is reported for field declaration on line 14: Struts: Form field 'SV_STRUTS_NOTRESET_Sample_1' 'name' is not reset by 'reset' method