Appscan 验证。java 中的必需问题

问题描述 投票:0回答:2

我在我的应用程序上运行了 appScan。我可以看到 String 对象的大多数 Validation.Required 问题。但是,不确定应用程序扫描在这里期望什么验证。我们尝试过使用 null 和空检查仍然没有用。请任何人告诉我appscan 对字符串对象的期望是什么。

    String tableName = this.request.getParameter(TABLE_NAME);

session.setAttribute(tableName + "_" + parentTableName + "_editColumnMap", editableColumnsMap);

如果您需要更多信息,请告诉我

java security bluemix-app-scan
2个回答
0
投票

减少 Validatoin.required 发现的主要目标是针对恶意输入进行验证。检查您的代码中是否有任何变量可以设置为可以由恶意用户控制的值。从系统外部获取的任何输入都应使用白名单进行验证或清理:https://www.owasp.org/index.php/Input_Validation_Cheat_Sheet#White_List_Input_Validation


0
投票

“Validation.Required”表示您正在使用最终用户提供的值,该值不受您自己的应用程序的控制。恶意最终用户可能会提供巨大的值供您的程序存储,从而导致内存和性能问题。

解决方案很简单,将长度限制在合理的范围内:

String tableName = this.request.getParameter(TABLE_NAME);

// There is no valid reason for a table name to be
// larger than 200 characters.
if (tableName.length() > 200) {
    throw new RuntimeException(
        "Request parameter '" + TABLE_NAME + "' is too long.");
}
© www.soinside.com 2019 - 2024. All rights reserved.