Am trying to resolve a resource injection issue found in our code by Fortify Static scan. We have updateUserInfo(User user)
method in Service
class which makes a call to updateUser(User user)
method on Dao
class. updateUser(User user)
method code has below lines of code.
public void updateUser(User user) {
Map params = new HashMap();
params.put("id", user.getId());
// below code makes a call to stored proc updateUser and passes params as parameters to database(ibatis config)
getSqlMap.update("updateUser", params);
}
Fortify complains that attacker can specify the value that enters at updateUserInfo
in Service
class and this value is used to access a system resource at the line getSqlMap.update
call.
I am not sure how to change this code to overcome this vulnerability. Please help.