Я получаю Unchecked Input для L oop Проблема с проверкой состояния.
Я пробовал обрабатывать рекомендуемый код, но у меня он не работает.
Описание отчета Checkmarx:
Method transformPojoCommon at line 334 of
to_web/src/com/toweb/bd/TrainCategoriesBD.java gets user input from
element TC_TRAIN_CAT_NAME . This element’s value flows through the
code without being validated, and is eventually used in a loop
condition in getParentTrainTypes at line 162 of
to_web/src/com/toweb/dao/TrainCategoriesDAO.java. This constitutes an
Unchecked Input for Loop Condition.
Я пробовал код ниже:
valdiateRequestInput(ESAPI.encoder().
canonicalize(request.getParameter(TOWebRequestConstants.TC_OBJID).trim()));
private String valdiateRequestInput(String currentPage) {
try {
currentPage = ESAPI.validator().getValidInput("HTTP parameter value: ", currentPage, "HTTPParameterValue", 2000, true);
} catch (Exception e1) {
log.error("failed to validate HTTP parameter value ", e1);
throw new IllegalArgumentException("failed to validate HTTP parameter value "+currentPage, e1);
}
return currentPage;
}